This commit is contained in:
parent
d57f4fc44a
commit
8ca097d4a9
|
@ -49,12 +49,12 @@ module.exports = Self => {
|
|||
where: {originalTicketFk: id}
|
||||
}, myOptions);
|
||||
|
||||
const isRefund = !!ticketRefunds?.length;
|
||||
const hasRefund = !!ticketRefunds?.length;
|
||||
|
||||
const allDeleted = ticketRefunds.every(refund => refund.refundTicket().isDeleted);
|
||||
|
||||
if (!isRefund) await models.TicketRefund.destroyAll({refundTicketFk: id}, myOptions);
|
||||
if (isRefund && !allDeleted) {
|
||||
if (!hasRefund) await models.TicketRefund.destroyAll({refundTicketFk: id}, myOptions);
|
||||
if (hasRefund && !allDeleted) {
|
||||
const notDeleted = [];
|
||||
for (const refund of ticketRefunds)
|
||||
if (!refund.refundTicket().isDeleted) notDeleted.push(refund.refundTicket().id);
|
||||
|
|
Loading…
Reference in New Issue