fix: cash cassette low condition
This commit is contained in:
parent
f570661724
commit
15ddf4cf83
1 changed files with 3 additions and 2 deletions
|
|
@ -615,6 +615,7 @@ function plugins (settings, deviceId) {
|
||||||
const denomination1 = cashOutConfig.top
|
const denomination1 = cashOutConfig.top
|
||||||
const denomination2 = cashOutConfig.bottom
|
const denomination2 = cashOutConfig.bottom
|
||||||
const cashOutEnabled = cashOutConfig.active
|
const cashOutEnabled = cashOutConfig.active
|
||||||
|
const isCassetteLow = (have, max, limit) => cashOutEnabled && ((have / max) * 100) < limit
|
||||||
|
|
||||||
const notifications = configManager.getNotifications(null, device.deviceId, settings.config)
|
const notifications = configManager.getNotifications(null, device.deviceId, settings.config)
|
||||||
|
|
||||||
|
|
@ -629,7 +630,7 @@ function plugins (settings, deviceId) {
|
||||||
}
|
}
|
||||||
: null
|
: null
|
||||||
|
|
||||||
const cassette1Alert = cashOutEnabled && (device.cassette1 / cassetteMaxCapacity) < notifications.fillingPercentageCassette1
|
const cassette1Alert = isCassetteLow(device.cassette1, cassetteMaxCapacity, notifications.fillingPercentageCassette1)
|
||||||
? {
|
? {
|
||||||
code: 'LOW_CASH_OUT',
|
code: 'LOW_CASH_OUT',
|
||||||
cassette: 1,
|
cassette: 1,
|
||||||
|
|
@ -641,7 +642,7 @@ function plugins (settings, deviceId) {
|
||||||
}
|
}
|
||||||
: null
|
: null
|
||||||
|
|
||||||
const cassette2Alert = cashOutEnabled && (device.cassette2 / cassetteMaxCapacity) < notifications.fillingPercentageCassette2
|
const cassette2Alert = isCassetteLow(device.cassette2, cassetteMaxCapacity, notifications.fillingPercentageCassette2)
|
||||||
? {
|
? {
|
||||||
code: 'LOW_CASH_OUT',
|
code: 'LOW_CASH_OUT',
|
||||||
cassette: 2,
|
cassette: 2,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue