refactor: use recyclers instead of stackers
This commit is contained in:
parent
dc52cf4414
commit
21b88f182e
37 changed files with 2868 additions and 9599 deletions
|
|
@ -40,18 +40,18 @@ exports.cassetteCounts = function cassetteCounts (deviceId) {
|
|||
})
|
||||
}
|
||||
|
||||
exports.stackerCounts = function stackerCounts (deviceId) {
|
||||
const sql = 'SELECT stacker1f, stacker1r, stacker2f, stacker2r, stacker3f, stacker3r, number_of_stackers FROM devices ' +
|
||||
exports.recyclerCounts = function recyclerCounts (deviceId) {
|
||||
const sql = 'SELECT recycler1, recycler2, recycler3, recycler4, recycler5, recycler6, number_of_recyclers FROM devices ' +
|
||||
'WHERE device_id=$1'
|
||||
|
||||
return db.one(sql, [deviceId])
|
||||
.then(row => {
|
||||
const counts = []
|
||||
_.forEach(it => {
|
||||
counts.push([row[`stacker${it + 1}f`], row[`stacker${it + 1}r`]])
|
||||
}, _.times(_.identity(), row.number_of_stackers))
|
||||
counts.push(row[`recycler${it + 1}`])
|
||||
}, _.times(_.identity(), row.number_of_recyclers))
|
||||
|
||||
return { numberOfStackers: row.number_of_stackers, counts }
|
||||
return { numberOfRecyclers: row.number_of_recyclers, counts }
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue