mirror of
https://github.com/IonicaBizau/git-stats.git
synced 2024-12-22 13:22:11 +01:00
Removed obsolete code
This commit is contained in:
parent
b37d057c0e
commit
68eb6235a7
1 changed files with 0 additions and 110 deletions
110
lib/index.js
110
lib/index.js
|
@ -282,122 +282,12 @@ GitStats.ansiCalendar = function (data, callback) {
|
||||||
cal.push([cDay, cDayObj.c]);
|
cal.push([cDay, cDayObj.c]);
|
||||||
});
|
});
|
||||||
|
|
||||||
debugger
|
|
||||||
callback(null, CliGhCal(cal, {
|
callback(null, CliGhCal(cal, {
|
||||||
theme: data.theme
|
theme: data.theme
|
||||||
, start: data.start
|
, start: data.start
|
||||||
, end: data.end
|
, end: data.end
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
var year = []
|
|
||||||
, months = new Array(52) // Stores the months depending on their first week
|
|
||||||
, cWeek = [" ", " ", " ", " ", " ", " ", " "]
|
|
||||||
, monthHack = "MM"
|
|
||||||
, sDay = ""
|
|
||||||
, cDayObj = null
|
|
||||||
, strYear = ""
|
|
||||||
, strMonths = ""
|
|
||||||
, w = 0
|
|
||||||
, d = 0
|
|
||||||
, when = "the last year"
|
|
||||||
, dataClone = {
|
|
||||||
start: data.start ? Moment(data.start.format(DATE_FORMAT), DATE_FORMAT) : null
|
|
||||||
, end: data.end ? Moment(data.end.format(DATE_FORMAT), DATE_FORMAT) : null
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
dataClone.s = data.start.format(DATE_FORMAT);
|
|
||||||
dataClone.e = data.end.format(DATE_FORMAT);
|
|
||||||
|
|
||||||
if (Moment().subtract(1, "years").format(DATE_FORMAT) !== dataClone.s
|
|
||||||
|| Moment().format(DATE_FORMAT) !== dataClone.e) {
|
|
||||||
when = [Couleurs.bold(dataClone.s), Couleurs.bold(dataClone.e)].join(" – ");
|
|
||||||
}
|
|
||||||
|
|
||||||
GitStats.calendar(data, function (err, cal) {
|
|
||||||
if (err) { return callback(err); }
|
|
||||||
GitStats.iterateDays(dataClone, function (cDay, mDay) {
|
|
||||||
sDay = mDay.format("ddd");
|
|
||||||
|
|
||||||
cDayObj = cal.days[cDay];
|
|
||||||
if (!cDayObj) return;
|
|
||||||
|
|
||||||
if (sDay === "Sun" && Object.keys(cWeek).length) {
|
|
||||||
year.push(cWeek);
|
|
||||||
cWeek = [" ", " ", " ", " ", " ", " ", " "];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Store the new month this week
|
|
||||||
if (mDay.format("D") === "1") {
|
|
||||||
months[year.length] = mDay.format("MMM");
|
|
||||||
}
|
|
||||||
|
|
||||||
cWeek[DAYS.indexOf(sDay)] = LEVELS[cDayObj.level];
|
|
||||||
});
|
|
||||||
|
|
||||||
if (cWeek.length) {
|
|
||||||
year.push(cWeek);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (d = 0; d < 7; ++d) {
|
|
||||||
for (w = 0; w < year.length; ++w) {
|
|
||||||
strYear += " " + year[w][d];
|
|
||||||
}
|
|
||||||
strYear += "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add day names
|
|
||||||
strYear = strYear.split("\n").map(function (c, i) {
|
|
||||||
if (i > 6) { return; }
|
|
||||||
return DAYS[i] + c;
|
|
||||||
}).join("\n");
|
|
||||||
|
|
||||||
// Months label
|
|
||||||
monthHack = "MMMM"; //Left padding
|
|
||||||
|
|
||||||
for (var i = 0; i < months.length; i++) {
|
|
||||||
// The length of strMonths should always be 2*(i+1) (at the i-th column)
|
|
||||||
if (!months[i]) {
|
|
||||||
strMonths += new Array(2*(i+1)-strMonths.length+1).join(" ");
|
|
||||||
} else {
|
|
||||||
strMonths += months[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
strYear = monthHack + strMonths + "\n" + strYear;
|
|
||||||
strYear +=
|
|
||||||
new Array(5 + 2 * Math.ceil(365 / 7)).join("-")
|
|
||||||
+ "\n" + "Commits in " + when + ": " + cal.total
|
|
||||||
+ " | " + "Longest Streak: " + cal.lStreak + " days"
|
|
||||||
+ " | " + "Current Streak: " + cal.cStreak + " days"
|
|
||||||
+ " | " + "Max a day: " + cal.max
|
|
||||||
;
|
|
||||||
|
|
||||||
strYear = new CliBox({
|
|
||||||
w: 10
|
|
||||||
, h: 10
|
|
||||||
, marks: {
|
|
||||||
nw: "╔"
|
|
||||||
, n: "═"
|
|
||||||
, ne: "╗"
|
|
||||||
, e: "║"
|
|
||||||
, se: "╝"
|
|
||||||
, s: "═"
|
|
||||||
, sw: "╚"
|
|
||||||
, w: "║"
|
|
||||||
, b: " "
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
text: strYear
|
|
||||||
, stretch: true
|
|
||||||
, hAlign: "left"
|
|
||||||
}).toString();
|
|
||||||
|
|
||||||
strYear = strYear.replace(monthHack, new Array(monthHack.length + 1).join(" "));
|
|
||||||
|
|
||||||
callback(null, strYear);
|
|
||||||
});
|
|
||||||
|
|
||||||
return GitStats;
|
return GitStats;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue