Skip to content

Commit fa2cdfe

Browse files
authored
Merge pull request #5 from ndu2/develop
Develop
2 parents 9b464d9 + fec31d3 commit fa2cdfe

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

documentation.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,11 @@ includeLabels:
616616
- pending
617617
- approved
618618

619+
# labels free of charge
620+
freeLabels:
621+
- at no charge
622+
- free
623+
619624
# Only works if using a local configuration file!
620625
# Extend the global configuration if set to true, pass a string to extend
621626
# the configuration file stored at the given path

src/output/base.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,16 @@ class base {
100100
let totalEstimate = 0;
101101
let totalSpent = 0;
102102
let spent = 0;
103+
let spentFree = 0;
103104
let users = {};
104105
let projects = {};
105106
let times = [];
106107

108+
let spentFreeLabels = this.config.get('freeLabels');
109+
if(undefined === spentFreeLabels) {
110+
spentFreeLabels = [];
111+
}
112+
107113
['issues', 'mergeRequests'].forEach(type => {
108114
this.report[type].forEach(issue => {
109115
issue.times.forEach(time => {
@@ -114,6 +120,16 @@ class base {
114120
projects[time.project_namespace] += time.seconds;
115121

116122
spent += time.seconds;
123+
//if(time.parent.labels)
124+
let free = false;
125+
time.parent.labels.forEach(label => {
126+
spentFreeLabels.forEach(freeLabel => {
127+
free |= (freeLabel == label);
128+
});
129+
});
130+
if(free) {
131+
spentFree += time.seconds;
132+
}
117133
times.push(time);
118134
});
119135

@@ -141,10 +157,12 @@ class base {
141157
this.stats = {
142158
'total estimate': this.config.toHumanReadable(totalEstimate, 'stats'),
143159
'total spent': this.config.toHumanReadable(totalSpent, 'stats'),
144-
'spent': this.config.toHumanReadable(spent, 'stats')
160+
'spent': this.config.toHumanReadable(spent, 'stats'),
161+
'spent free': this.config.toHumanReadable(spentFree, 'stats'),
145162
};
146163
this.totalEstimate = totalEstimate;
147164
this.spent = spent;
165+
this.spentFree = spentFree;
148166
this.totalSpent = totalSpent;
149167
}
150168

src/output/invoice.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class invoice extends Base {
1919
this.invoiceCurrencyPerHour = this.config.get('invoiceCurrencyPerHour');
2020
this.invoiceVAT = this.config.get('invoiceVAT');
2121
this.invoiceCurrencyMaxUnit = this.config.get('invoiceCurrencyMaxUnit');
22-
this.totalhForInvoice = this.spent / 3600.0;
22+
this.totalhForInvoice = (this.spent-this.spentFree) / 3600.0;
2323
this.totalForInvoiceExkl = this.totalhForInvoice * this.invoiceCurrencyPerHour;
2424
this.totalForInvoiceMwst = this.totalForInvoiceExkl * this.invoiceVAT;
2525
this.totalForInvoice = this.totalForInvoiceExkl + this.totalForInvoiceMwst;

0 commit comments

Comments
 (0)