Merge pull request #891 from SiIky/fix/z3MakfSR/invalidate_notifications

Fix cash cassette alerts
This commit is contained in:
Rafael Taranto 2021-11-11 18:30:05 +00:00 committed by GitHub
commit 7cf5f88c21
2 changed files with 3 additions and 10 deletions

View file

@ -616,6 +616,7 @@ function plugins (settings, deviceId) {
const denomination1 = cashOutConfig.top
const denomination2 = cashOutConfig.bottom
const cashOutEnabled = cashOutConfig.active
const isCassetteLow = (have, max, limit) => cashOutEnabled && ((have / max) * 100) < limit
const notifications = configManager.getNotifications(null, device.deviceId, settings.config)
@ -630,7 +631,7 @@ function plugins (settings, deviceId) {
}
: null
const cassette1Alert = cashOutEnabled && (device.cassette1 / cassetteMaxCapacity) < notifications.fillingPercentageCassette1
const cassette1Alert = isCassetteLow(device.cassette1, cassetteMaxCapacity, notifications.fillingPercentageCassette1)
? {
code: 'LOW_CASH_OUT',
cassette: 1,
@ -642,7 +643,7 @@ function plugins (settings, deviceId) {
}
: null
const cassette2Alert = cashOutEnabled && (device.cassette2 / cassetteMaxCapacity) < notifications.fillingPercentageCassette2
const cassette2Alert = isCassetteLow(device.cassette2, cassetteMaxCapacity, notifications.fillingPercentageCassette2)
? {
code: 'LOW_CASH_OUT',
cassette: 2,