From 7c5bb1d0487c1e35e43d09e9c313d3241c0d7449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Sun, 1 Feb 2015 15:43:45 +0200 Subject: [PATCH] Show the max per day --- lib/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/index.js b/lib/index.js index 37cb972..c693e4b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -156,10 +156,9 @@ GitStats.calendar = function (data, callback) { GitStats.graph(data, function (err, graph) { 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 , days = Object.keys(graph) - , max = 0 , levels = null , cLevel = 0 ; @@ -167,8 +166,8 @@ GitStats.calendar = function (data, callback) { days.forEach(function (c) { cDay = graph[c]; cal.total += cDay.c; - if (cDay.c > max) { - max = cDay.c; + if (cDay.c > cal.max) { + cal.max = cDay.c; } 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) { cDay = graph[c]; @@ -248,6 +247,7 @@ GitStats.ansiCalendar = function (data, callback) { + "\n" + "Contributions in the last year: " + cal.total + " | " + "Longest Streak: " + cal.lStreak + " days" + " | " + "Current Streak: " + cal.cStreak + " days" + + " | " + "Max a day: " + cal.max ; strYear = new CliBox({