Skip to content

Commit cf1ec45

Browse files
author
Andreas Müller
committed
support half-price labels
1 parent 307d85b commit cf1ec45

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/output/base.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class base {
109109
let totalSpent = 0;
110110
let spent = 0;
111111
let spentFree = 0;
112+
let spentHalfPrice = 0;
112113
let users = {};
113114
let projects = {};
114115
let times = [];
@@ -120,6 +121,10 @@ class base {
120121
if(undefined === spentFreeLabels) {
121122
spentFreeLabels = [];
122123
}
124+
let spentHalfPriceLabels = this.config.get('halfPriceLabels');
125+
if(undefined === spentHalfPriceLabels) {
126+
spentHalfPriceLabels = [];
127+
}
123128

124129
['issues', 'mergeRequests'].forEach(type => {
125130
this.report[type].forEach(issue => {
@@ -146,14 +151,24 @@ class base {
146151
spent += time.seconds;
147152
//if(time.parent.labels)
148153
let free = false;
154+
let halfPrice = false;
149155
time.parent.labels.forEach(label => {
150156
spentFreeLabels.forEach(freeLabel => {
151157
free |= (freeLabel == label);
152158
});
153159
});
160+
time.parent.labels.forEach(label => {
161+
spentHalfPriceLabels.forEach(halfPriceLabel => {
162+
halfPrice |= (halfPriceLabel == label);
163+
});
164+
});
165+
154166
if(free) {
155167
spentFree += time.seconds;
156168
}
169+
if(halfPrice) {
170+
spentHalfPrice += time.seconds;
171+
}
157172
times.push(time);
158173
});
159174
issue.timesWarnings.forEach(warning => timesWarnings.push(warning));
@@ -190,6 +205,7 @@ class base {
190205
this.totalEstimate = totalEstimate;
191206
this.spent = spent;
192207
this.spentFree = spentFree;
208+
this.spentHalfPrice = spentHalfPrice;
193209
this.totalSpent = totalSpent;
194210
this.timesWarnings = timesWarnings;
195211
}

src/output/invoice.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ ${closing}
173173
this.headline('Total');
174174
//this.write(stats.substr(1));
175175
this.write(this.config.toHumanReadable(this.spent, 'stats'));
176+
this.write(this.config.toHumanReadable(this.spentHalfPrice, 'statsHalfPrice'));
176177
this.write(this.config.toHumanReadable(this.spentFree, 'statsFree'));
177178

178179
// warnings

0 commit comments

Comments
 (0)