From 2e15d576cb9da0a91552adc3e8b4f480be476e74 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Mon, 28 Aug 2023 10:24:13 +0100 Subject: [PATCH] fix: cashbox count returning null --- lib/machine-loader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/machine-loader.js b/lib/machine-loader.js index 0fafb9ac..c60559c3 100644 --- a/lib/machine-loader.js +++ b/lib/machine-loader.js @@ -19,7 +19,7 @@ const unresponsiveStatus = { label: 'Unresponsive', type: 'error' } const stuckStatus = { label: 'Stuck', type: 'error' } const MACHINE_WITH_CALCULATED_FIELD_SQL = ` -select d.*, emptybills + regularbills as cashbox from devices d +select d.*, COALESCE(emptybills, 0) + COALESCE(regularbills, 0) as cashbox from devices d left join ( select count(*) as emptyBills, eub.device_id from empty_unit_bills eub