Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
hack to get daily stats over multiple projects
  • Loading branch information
Andreas Müller committed Mar 15, 2021
commit 8058e702ff962ae02f6258e7d501ae59be5d034f
30 changes: 30 additions & 0 deletions src/output/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,37 @@ class table extends Base {
this.write(mergeRequests.toString());
}

makeDailyStats() {
this.headline('DAILY RECORDS');

var tabledt = new Table({head: ['date', 'time']});
var tabledit = new Table({head: ['date', 'project', 'iid', 'time']});
let days = Object.keys(this.days);
days.sort();
days.forEach(
k => {
let day = this.days[k];
let refD = this.daysMoment[k].format(this.config.get('dateFormat'));
let projects = Object.keys(day);
let time = 0;
projects.forEach(
p => {
let iids = Object.keys(day[p]);
iids.sort();
iids.forEach(
iid => {
tabledit.push([refD, p, iid, this.config.toHumanReadable(day[p][iid], 'records')]);
time += day[p][iid];
});
});
tabledt.push([refD, this.config.toHumanReadable(time)]);
});
this.write(tabledt.toString());
this.write(tabledit.toString());
}

makeRecords() {
this.makeDailyStats();
this.headline('TIME RECORDS');
let times = new Table({head: this.config.get('recordColumns').map(c => c.replace('_', ' '))});
this.times.forEach(time => times.push(this.prepare(time, this.config.get('recordColumns'))));
Expand Down