Skip to content

Commit 6f24ba3

Browse files
author
Andreas Müller
committed
added: spent free options
1 parent e6de105 commit 6f24ba3

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-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: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,13 @@ 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+
107110
['issues', 'mergeRequests'].forEach(type => {
108111
this.report[type].forEach(issue => {
109112
issue.times.forEach(time => {
@@ -114,6 +117,16 @@ class base {
114117
projects[time.project_namespace] += time.seconds;
115118

116119
spent += time.seconds;
120+
//if(time.parent.labels)
121+
let free = false;
122+
time.parent.labels.forEach(label => {
123+
spentFreeLabels.forEach(freeLabel => {
124+
free |= (freeLabel == label);
125+
});
126+
});
127+
if(free) {
128+
spentFree += time.seconds;
129+
}
117130
times.push(time);
118131
});
119132

@@ -141,10 +154,12 @@ class base {
141154
this.stats = {
142155
'total estimate': this.config.toHumanReadable(totalEstimate, 'stats'),
143156
'total spent': this.config.toHumanReadable(totalSpent, 'stats'),
144-
'spent': this.config.toHumanReadable(spent, 'stats')
157+
'spent': this.config.toHumanReadable(spent, 'stats'),
158+
'spent free': this.config.toHumanReadable(spentFree, 'stats'),
145159
};
146160
this.totalEstimate = totalEstimate;
147161
this.spent = spent;
162+
this.spentFree = spentFree;
148163
this.totalSpent = totalSpent;
149164
}
150165

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)