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 Dec 28, 2021
commit add5c7972b63d2d5ed8e2c6d31aa8f3dc34a42e8
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