fix(invoice): prevented error for invoiced tickets without sales
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2021-10-04 08:41:34 +02:00
parent 580231d30b
commit 8828247b0d
1 changed files with 5 additions and 2 deletions

View File

@ -19,12 +19,14 @@ module.exports = {
const map = new Map();
for (let ticket of tickets)
for (let ticket of tickets) {
ticket.sales = [];
map.set(ticket.id, ticket);
}
for (let sale of sales) {
const ticket = map.get(sale.ticketFk);
if (!ticket.sales) ticket.sales = [];
ticket.sales.push(sale);
}
@ -93,6 +95,7 @@ module.exports = {
},
ticketSubtotal(ticket) {
let subTotal = 0.00;
console.log(ticket.sales);
for (let sale of ticket.sales)
subTotal += this.saleImport(sale);