refactor: use recyclers instead of stackers

This commit is contained in:
Rafael Taranto 2023-10-09 14:41:33 +01:00
parent dc52cf4414
commit 21b88f182e
37 changed files with 2868 additions and 9599 deletions

View file

@ -50,17 +50,17 @@ function insertNewBills (t, billRows, machineTx) {
const columns = ['id', 'fiat', 'fiat_code', 'crypto_code', 'cash_in_fee', 'cash_in_txs_id', 'device_time', 'destination_unit']
const sql = pgp.helpers.insert(dbBills, columns, 'bills')
const deviceID = machineTx.deviceId
const sql2 = `update devices set stacker1f = stacker1f + $2, stacker1r = stacker1r + $3, stacker2f = stacker2f + $4, stacker2r = stacker2r + $5, stacker3f = stacker3f + $6, stacker3r = stacker3r + $7
const sql2 = `update devices set recycler1 = recycler1 + $2, recycler2 = recycler2 + $3, recycler3 = recycler3 + $4, recycler4 = recycler4 + $5, recycler5 = recycler5 + $6, recycler6 = recycler6 + $7
where device_id = $1`
return t.none(sql2, [
deviceID,
getBillsByDestination('stacker1f').length,
getBillsByDestination('stacker1r').length,
getBillsByDestination('stacker2f').length,
getBillsByDestination('stacker2r').length,
getBillsByDestination('stacker3f').length,
getBillsByDestination('stacker3r').length
getBillsByDestination('recycler1').length,
getBillsByDestination('recycler2').length,
getBillsByDestination('recycler3').length,
getBillsByDestination('recycler4').length,
getBillsByDestination('recycler5').length,
getBillsByDestination('recycler6').length
])
.then(() => {
return t.none(sql)