Distort the contribution values a little bit.

This commit is contained in:
Ionică Bizău 2015-02-08 18:45:23 +02:00
parent 2f83ab4aee
commit 7c94d1865e

View file

@ -7,8 +7,7 @@ var Ul = require("ul")
// Constants // Constants
const STORE_PATH = Ul.USER_DIR + "/.git-stats" const STORE_PATH = Ul.USER_DIR + "/.git-stats"
, LEVELS = 5 , LEVELS = [
, SQUARES = [
"⬚" "⬚"
, "▢" , "▢"
, "▤" , "▤"
@ -191,14 +190,13 @@ GitStats.calendar = function (data, callback) {
} }
}); });
levels = Math.ceil(cal.max / LEVELS); levels = Math.ceil(cal.max / (LEVELS.length * 3));
days.forEach(function (c) { days.forEach(function (c) {
cDay = graph[c]; cDay = graph[c];
cal.days[c] = { cal.days[c] = {
c: cDay.c c: cDay.c
, level: !levels , level: !levels
? 0 : (cLevel = Math.floor(cDay.c / levels)) >= 5 ? 0 : (cLevel = Math.floor(cDay.c / levels )) >= 5
? 4 : !cLevel && cDay.c > 0 ? 1 : cLevel ? 4 : !cLevel && cDay.c > 0 ? 1 : cLevel
}; };
}); });
@ -243,7 +241,7 @@ GitStats.ansiCalendar = function (data, callback) {
cWeek = [" ", " ", " ", " ", " ", " ", " "]; cWeek = [" ", " ", " ", " ", " ", " ", " "];
} }
cWeek[DAYS.indexOf(sDay)] = SQUARES[cDayObj.level]; cWeek[DAYS.indexOf(sDay)] = LEVELS[cDayObj.level];
}); });
if (cWeek.length) { if (cWeek.length) {