refs #6915 test_master24_8 #2067

Merged
alexm merged 561 commits from test_master24_8 into master 2024-02-22 07:31:34 +00:00
1 changed files with 3 additions and 4 deletions
Showing only changes of commit 744171dd4c - Show all commits

View File

@ -34,6 +34,7 @@ module.exports = Self => {
const myOptions = {userId: ctx.req.accessToken.userId}; const myOptions = {userId: ctx.req.accessToken.userId};
let tx; let tx;
let ticket; let ticket;
let externalTickets = [];
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
@ -89,7 +90,6 @@ module.exports = Self => {
} }
try { try {
let externalTickets = [];
for (const ticketId of tickets) { for (const ticketId of tickets) {
ticket = await models.Ticket.findById(ticketId, { ticket = await models.Ticket.findById(ticketId, {
include: [{ include: [{
@ -154,11 +154,10 @@ module.exports = Self => {
} }
} }
if (tx) await tx.commit(); if (tx) await tx.commit();
await models.Route.cmrEmail(ctx, externalTickets);
return;
} catch (e) { } catch (e) {
if (tx && tx.isActive()) await tx.rollback(); if (tx) await tx.rollback();
throw e; throw e;
} }
await models.Route.cmrEmail(ctx, externalTickets);
}; };
}; };