7569_sendEmail #3387
|
@ -161,20 +161,21 @@ module.exports = Self => {
|
|||
if (stateCode == 'DELIVERED' && ticket.priority) {
|
||||
const orderState = await models.State.findOne({
|
||||
where: {code: 'DELIVERED'},
|
||||
fields: ['id']
|
||||
fields: ['order']
|
||||
}, myOptions);
|
||||
|
||||
const ticketIncorrect = await Self.rawSql(`
|
||||
SELECT t.id
|
||||
FROM ticket t
|
||||
JOIN ticketState ts ON ts.ticketFk = t.id
|
||||
JOIN state s ON s.code = ts.code
|
||||
SELECT tls.ticketFk
|
||||
FROM ticketLastState tls
|
||||
sergiodt marked this conversation as resolved
Outdated
|
||||
JOIN ticketTracking tt ON tt.id = tls.ticketTrackingFk
|
||||
JOIN ticket t ON t.id = tt.ticketFk
|
||||
JOIN state s ON s.id = tt.stateFk
|
||||
WHERE t.routeFk = ?
|
||||
AND s.\`order\` < ?
|
||||
AND priority <(SELECT t.priority
|
||||
FROM ticket t
|
||||
WHERE t.id = ?)`
|
||||
, [ticket.routeFk, orderState.id, ticket.id], myOptions);
|
||||
, [ticket.routeFk, orderState.order, ticket.id], myOptions);
|
||||
|
||||
if (ticketIncorrect?.length > 0)
|
||||
await sendMail(ticket.routeFk, ticket.id, ticket.zone().name);
|
||||
|
|
|
@ -60,7 +60,7 @@ describe('Ticket saveSign()', () => {
|
|||
expect(ticketTrackingAfter.name).toBe('Entregado en parte');
|
||||
});
|
||||
|
||||
it('should send an email to notify that the delivery order is not correct', async() => {
|
||||
fit('should send an email to notify that the delivery order is not correct', async() => {
|
||||
const tx = await models.Ticket.beginTransaction({});
|
||||
const ticketFk = 8;
|
||||
const priority = 5;
|
||||
|
|
Loading…
Reference in New Issue
TAB