From f570661724406a453c91904b9cb9f2044c92b6a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20S=C3=A1?= Date: Mon, 18 Oct 2021 18:34:22 +0100 Subject: [PATCH 1/2] chore: remove duplicate procedure --- lib/machine-loader.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/machine-loader.js b/lib/machine-loader.js index c2729f83..5ce26a5a 100644 --- a/lib/machine-loader.js +++ b/lib/machine-loader.js @@ -74,14 +74,6 @@ function getMachineNames (config) { const mergeByDeviceId = (x, y) => _.values(_.merge(_.keyBy('deviceId', x), _.keyBy('deviceId', y))) const machines = mergeByDeviceId(mergeByDeviceId(rawMachines, heartbeat), performance) - const getStatus = (ping, stuck) => { - if (ping && ping.age) return unresponsiveStatus - - if (stuck && stuck.age) return stuckStatus - - return fullyFunctionalStatus - } - const addName = r => { const cashOutConfig = configManager.getCashOut(r.deviceId, config) From 15ddf4cf83bd8a9a4826863df02e9e87ed7a8ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20S=C3=A1?= Date: Wed, 20 Oct 2021 15:33:42 +0100 Subject: [PATCH 2/2] fix: cash cassette low condition --- lib/plugins.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/plugins.js b/lib/plugins.js index c2262476..5f0f5762 100644 --- a/lib/plugins.js +++ b/lib/plugins.js @@ -615,6 +615,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) @@ -629,7 +630,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, @@ -641,7 +642,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,