mirror of
https://github.com/IonicaBizau/git-stats.git
synced 2025-01-11 22:11:53 +01:00
Get stats using the get method.
This commit is contained in:
parent
704f1c9a42
commit
c562c7ee3a
1 changed files with 4 additions and 2 deletions
|
@ -25,9 +25,10 @@ var GitStats = module.exports = {};
|
|||
* @return {undefined}
|
||||
*/
|
||||
GitStats.record = function (data, callback) {
|
||||
|
||||
// Validate data
|
||||
callback = callback || function (err) { if (err) throw err; };
|
||||
data = Object(data);
|
||||
|
||||
if (typeof data.date === "string") {
|
||||
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."));
|
||||
}
|
||||
|
||||
FsExtra.readJSON(STORE_PATH, function (err, stats) {
|
||||
// Get stats
|
||||
GitStats.get(function (err, stats) {
|
||||
stats = stats || {};
|
||||
var day = data.date.format("MMM DDD dd, YYYY")
|
||||
, today = stats[day] = Object(stats[day])
|
||||
|
|
Loading…
Reference in a new issue