mirror of
https://github.com/IonicaBizau/git-stats.git
synced 2024-10-01 12:41:29 +02:00
Get stats using the get method.
This commit is contained in:
parent
704f1c9a42
commit
c562c7ee3a
@ -25,9 +25,10 @@ var GitStats = module.exports = {};
|
|||||||
* @return {undefined}
|
* @return {undefined}
|
||||||
*/
|
*/
|
||||||
GitStats.record = function (data, callback) {
|
GitStats.record = function (data, callback) {
|
||||||
|
|
||||||
|
// Validate data
|
||||||
callback = callback || function (err) { if (err) throw err; };
|
callback = callback || function (err) { if (err) throw err; };
|
||||||
data = Object(data);
|
data = Object(data);
|
||||||
|
|
||||||
if (typeof data.date === "string") {
|
if (typeof data.date === "string") {
|
||||||
data.date = Moment(data.date, "DDD MMM dd HH:mm:ss YYYY");
|
data.date = Moment(data.date, "DDD MMM dd HH:mm:ss YYYY");
|
||||||
}
|
}
|
||||||
@ -44,7 +45,8 @@ GitStats.record = function (data, callback) {
|
|||||||
return callback(new Error("Invalid url field."));
|
return callback(new Error("Invalid url field."));
|
||||||
}
|
}
|
||||||
|
|
||||||
FsExtra.readJSON(STORE_PATH, function (err, stats) {
|
// Get stats
|
||||||
|
GitStats.get(function (err, stats) {
|
||||||
stats = stats || {};
|
stats = stats || {};
|
||||||
var day = data.date.format("MMM DDD dd, YYYY")
|
var day = data.date.format("MMM DDD dd, YYYY")
|
||||||
, today = stats[day] = Object(stats[day])
|
, today = stats[day] = Object(stats[day])
|
||||||
|
Loading…
Reference in New Issue
Block a user