mirror of
https://github.com/IonicaBizau/git-stats.git
synced 2025-01-03 10:22:11 +01:00
Show the max per day
This commit is contained in:
parent
6de0cdb11f
commit
7c5bb1d048
1 changed files with 5 additions and 5 deletions
10
lib/index.js
10
lib/index.js
|
@ -156,10 +156,9 @@ GitStats.calendar = function (data, callback) {
|
||||||
GitStats.graph(data, function (err, graph) {
|
GitStats.graph(data, function (err, graph) {
|
||||||
if (err) { return callback(err); }
|
if (err) { return callback(err); }
|
||||||
|
|
||||||
var cal = { total: 0, days: {}, cStreak: 0, lStreak: 0 }
|
var cal = { total: 0, days: {}, cStreak: 0, lStreak: 0, max: 0 }
|
||||||
, cDay = null
|
, cDay = null
|
||||||
, days = Object.keys(graph)
|
, days = Object.keys(graph)
|
||||||
, max = 0
|
|
||||||
, levels = null
|
, levels = null
|
||||||
, cLevel = 0
|
, cLevel = 0
|
||||||
;
|
;
|
||||||
|
@ -167,8 +166,8 @@ GitStats.calendar = function (data, callback) {
|
||||||
days.forEach(function (c) {
|
days.forEach(function (c) {
|
||||||
cDay = graph[c];
|
cDay = graph[c];
|
||||||
cal.total += cDay.c;
|
cal.total += cDay.c;
|
||||||
if (cDay.c > max) {
|
if (cDay.c > cal.max) {
|
||||||
max = cDay.c;
|
cal.max = cDay.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cDay.c > 0) {
|
if (cDay.c > 0) {
|
||||||
|
@ -180,7 +179,7 @@ GitStats.calendar = function (data, callback) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
levels = max / LEVELS;
|
levels = Math.ceil(cal.max / LEVELS);
|
||||||
|
|
||||||
days.forEach(function (c) {
|
days.forEach(function (c) {
|
||||||
cDay = graph[c];
|
cDay = graph[c];
|
||||||
|
@ -248,6 +247,7 @@ GitStats.ansiCalendar = function (data, callback) {
|
||||||
+ "\n" + "Contributions in the last year: " + cal.total
|
+ "\n" + "Contributions in the last year: " + cal.total
|
||||||
+ " | " + "Longest Streak: " + cal.lStreak + " days"
|
+ " | " + "Longest Streak: " + cal.lStreak + " days"
|
||||||
+ " | " + "Current Streak: " + cal.cStreak + " days"
|
+ " | " + "Current Streak: " + cal.cStreak + " days"
|
||||||
|
+ " | " + "Max a day: " + cal.max
|
||||||
;
|
;
|
||||||
|
|
||||||
strYear = new CliBox({
|
strYear = new CliBox({
|
||||||
|
|
Loading…
Reference in a new issue