From 9423a2d04351b165ddde6c5bb93f133599212bdf Mon Sep 17 00:00:00 2001 From: sergiodt Date: Thu, 4 Apr 2024 10:38:55 +0200 Subject: [PATCH] refs #3520 hotFix: hasUncheckedTickets --- .../ticket/back/methods/ticket-collection/hasUncheckedTicket.js | 2 +- .../methods/ticket-collection/spec/hasUncheckedTicket.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/ticket-collection/hasUncheckedTicket.js b/modules/ticket/back/methods/ticket-collection/hasUncheckedTicket.js index 1ea522de6..43f6faa96 100644 --- a/modules/ticket/back/methods/ticket-collection/hasUncheckedTicket.js +++ b/modules/ticket/back/methods/ticket-collection/hasUncheckedTicket.js @@ -35,6 +35,6 @@ module.exports = Self => { WHERE tc.ticketFk = ? AND s.order < s2.id LIMIT 1;`, [ticketFk], myOptions); - return result.length > 0 && result[0]['ticketFk'] > 0; + return result[0]?.ticketFk > 0 && result[0].ticketFk; }; }; diff --git a/modules/ticket/back/methods/ticket-collection/spec/hasUncheckedTicket.spec.js b/modules/ticket/back/methods/ticket-collection/spec/hasUncheckedTicket.spec.js index ae7a8e6ee..a75784a23 100644 --- a/modules/ticket/back/methods/ticket-collection/spec/hasUncheckedTicket.spec.js +++ b/modules/ticket/back/methods/ticket-collection/spec/hasUncheckedTicket.spec.js @@ -27,7 +27,7 @@ describe('ticketCollection hasUncheckedTicket()', () => { }, myOptions); const result = await models.TicketCollection.hasUncheckedTicket(ticketFk, myOptions); - expect(result).toBe(true); + expect(result).toBeTruthy(); await tx.rollback(); } catch (e) { await tx.rollback();