Skip to content

Commit 75cd27e

Browse files
committed
Merge branch 'feature-active-days-and-user-filter' of github.com:Happyesss/git-stats into new-version
2 parents a4b8d8a + 8e1cea2 commit 75cd27e

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

lib/index.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const DEFAULT_DATA = {
2323
commits: {}
2424
}
2525
const CONFIG_PATH = Abs("~/.git-stats-config.js")
26+
const LEVELS = [0, 1, 2, 3, 4]
2627

2728

2829
class GitStats {
@@ -417,7 +418,8 @@ class GitStats {
417418
days: {},
418419
cStreak: 0,
419420
lStreak: 0,
420-
max: 0
421+
max: 0,
422+
activeDays: 0
421423
},
422424
cDay = null,
423425
days = Object.keys(graph),
@@ -432,6 +434,7 @@ class GitStats {
432434
}
433435

434436
if (cDay.c > 0) {
437+
cal.activeDays++;
435438
if (++cal.cStreak > cal.lStreak) {
436439
cal.lStreak = cal.cStreak;
437440
}
@@ -475,7 +478,12 @@ class GitStats {
475478

476479
const self = this;
477480

478-
self.graph(options, function (err, graph) {
481+
// Get calendar data which includes activeDays
482+
self.calendar(options, function (err, calendarData) {
483+
if (err) {
484+
return callback(err);
485+
}
486+
479487
let cal = [],
480488
data = {
481489
theme: options.theme,
@@ -484,11 +492,12 @@ class GitStats {
484492
firstDay: options.firstDay // [DEPRECATED] https://github.com/IonicaBizau/git-stats/issues/121
485493
,
486494
cal: cal,
487-
raw: options.raw
495+
raw: options.raw,
496+
activeDays: calendarData.activeDays
488497
};
489498

490499
self.iterateDays(options, function (cDay) {
491-
const cDayObj = graph[cDay];
500+
const cDayObj = calendarData.days[cDay];
492501
if (!cDayObj) {
493502
return;
494503
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
1616
"William Boman <[email protected]>",
1717
"Fabian Furger <[email protected]>",
18-
"Jonah Lawrence <[email protected]>"
18+
"Jonah Lawrence <[email protected]>",
19+
"Shashank kumar rathour <[email protected]>"
1920
],
2021
"license": "MIT",
2122
"repository": {

0 commit comments

Comments
 (0)