bug fixed list producction
This commit is contained in:
parent
2bb87dc195
commit
d19ebe0c8c
|
@ -68,16 +68,17 @@ module.exports = function(Self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sum(tickets) {
|
function sum(tickets) {
|
||||||
var obj = {lines: 0, m3: 0};
|
let obj = {lines: 0, m3: 0};
|
||||||
tickets.forEach(function(t, i) {
|
if (tickets && tickets.length)
|
||||||
obj.lines += t.lines;
|
tickets.forEach(function(t, i) {
|
||||||
obj.m3 += t.m3;
|
obj.lines += t.lines;
|
||||||
if (tickets[i].problem)
|
obj.m3 += t.m3;
|
||||||
tickets[i].problem = tickets[i].problem.trim();
|
if (tickets[i].problem)
|
||||||
}, this);
|
tickets[i].problem = tickets[i].problem.trim();
|
||||||
|
}, this);
|
||||||
obj.m3 = obj.m3.toFixed(2);
|
obj.m3 = obj.m3.toFixed(2);
|
||||||
obj.total = tickets.length;
|
obj.total = tickets ? tickets.length : 0;
|
||||||
obj.tickets = tickets;
|
obj.tickets = tickets || [];
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue