From a44359762b188ac5b223b3fe26499dab4db2fb5b Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 6 Mar 2024 14:51:34 +0100 Subject: [PATCH] feat(delay): refs #6005 add new restriction --- .../email/backup-printer-selected/backup-printer-selected.js | 4 +--- .../backup-printer-selected/sql/previousNotifications.sql | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/print/templates/email/backup-printer-selected/backup-printer-selected.js b/print/templates/email/backup-printer-selected/backup-printer-selected.js index 04a82b0c7..3578d0476 100755 --- a/print/templates/email/backup-printer-selected/backup-printer-selected.js +++ b/print/templates/email/backup-printer-selected/backup-printer-selected.js @@ -5,10 +5,8 @@ const name = 'backup-printer-selected'; module.exports = { name: name, async serverPrefetch() { - const notifications1 = await this.rawSqlFromDef('previousNotificationscopy', [name]); - console.log('notifications: ', notifications1); const notifications = await this.rawSqlFromDef('previousNotifications', [name]); - if (!notifications.length && checkDuplicates(notifications, this.labelerId, this.sectorId)) + if (!notifications.length || checkDuplicates(notifications, this.labelerId, this.sectorId)) throw new Error('Previous notification sended with the same parameters'); this.sector = await this.findOneFromDef('sector', [this.sectorId]); diff --git a/print/templates/email/backup-printer-selected/sql/previousNotifications.sql b/print/templates/email/backup-printer-selected/sql/previousNotifications.sql index bd44b05e4..2e2a8b93f 100644 --- a/print/templates/email/backup-printer-selected/sql/previousNotifications.sql +++ b/print/templates/email/backup-printer-selected/sql/previousNotifications.sql @@ -1,4 +1,4 @@ -SELECT nq.params +SELECT nq.params, created, status FROM util.notificationQueue nq JOIN util.notification n ON n.name = nq.notificationFk WHERE n.name = ?