Skip to content

Commit fa6a879

Browse files
author
Andreas Müller
committed
do not mix projects
1 parent 05ab51a commit fa6a879

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/output/base.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,17 @@ class base {
131131
days[dateGrp] = {}
132132
daysMoment[dateGrp] = time.date;
133133
};
134-
if(!days[dateGrp][time.iid]) {
135-
days[dateGrp][time.iid] = 0;
134+
if(!days[dateGrp][time.project_namespace]) {
135+
days[dateGrp][time.project_namespace] = {};
136136
}
137+
if(!days[dateGrp][time.project_namespace][time.iid]) {
138+
days[dateGrp][time.project_namespace][time.iid] = 0;
139+
}
140+
137141

138142
users[time.user] += time.seconds;
139143
projects[time.project_namespace] += time.seconds;
140-
days[dateGrp][time.iid] += time.seconds;
144+
days[dateGrp][time.project_namespace][time.iid] += time.seconds;
141145

142146
spent += time.seconds;
143147
//if(time.parent.labels)

src/output/invoice.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,22 @@ ${closing}
133133
makeRecords() {
134134
this.headline('Details');
135135

136-
let times = [['date', 'iid', 'time']];
136+
let times = [['date', 'project', 'iid', 'time']];
137137
let days = Object.keys(this.days);
138138
days.sort();
139139
days.forEach(
140140
k => {
141141
let day = this.days[k];
142142
let refD = this.daysMoment[k].format(this.config.get('dateFormat'));
143-
let iids = Object.keys(day);
144-
iids.sort();
145-
iids.forEach(
146-
iid => {
147-
times.push([refD, iid, this.config.toHumanReadable(day[iid], 'records')]);
143+
let projects = Object.keys(day);
144+
projects.forEach(
145+
p => {
146+
let iids = Object.keys(day[p]);
147+
iids.sort();
148+
iids.forEach(
149+
iid => {
150+
times.push([refD, p, iid, this.config.toHumanReadable(day[p][iid], 'records')]);
151+
});
148152
});
149153
});
150154
//let times = [this.config.get('recordColumns').map(c => c.replace('_', ' '))];

0 commit comments

Comments
 (0)