improve config loading; remove debug

This commit is contained in:
Josh Harvey 2017-04-25 02:25:32 +03:00
parent 5f0b70ca42
commit 614c64646a
15 changed files with 198 additions and 193 deletions

View file

@ -36,7 +36,6 @@ function httpError (msg, code) {
}
function post (tx, pi) {
console.log('DEBUG101: %j', tx)
const TransactionMode = pgp.txMode.TransactionMode
const isolationLevel = pgp.txMode.isolationLevel
const tmSRD = new TransactionMode({tiLevel: isolationLevel.serializable})
@ -104,7 +103,6 @@ function logAction (action, _rec, tx) {
const rec = _.assign(_rec, {action, tx_id: tx.id, redeem: !!tx.redeem})
const sql = pgp.helpers.insert(rec, null, 'cash_out_actions')
console.log('DEBUG110: %j', sql)
return db.none(sql)
.then(_.constant(tx))
}
@ -204,9 +202,7 @@ function update (tx, changes) {
}
function nextHd (isHd, tx) {
console.log('DEBUG160: %s', isHd)
if (!isHd) return Promise.resolve(tx)
console.log('DEBUG161: %s', isHd)
return db.one("select nextval('hd_indices_seq') as hd_index")
.then(row => _.set('hdIndex', row.hd_index, tx))
@ -257,9 +253,7 @@ function preProcess (oldTx, newTx, pi) {
return logAction(updatedTx.status, rec, updatedTx)
}
console.log('DEBUG120: %j', [oldTx, updatedTx])
if (!oldTx.dispenseConfirmed && updatedTx.dispenseConfirmed) {
console.log('DEBUG121')
return logDispense(updatedTx)
.then(updateCassettes(updatedTx))
}
@ -280,7 +274,6 @@ function postProcess (txVector, pi) {
const [oldTx, newTx] = txVector
if (newTx.dispense && !oldTx.dispense) {
console.log('DEBUG130')
return pi.buildCassettes()
.then(cassettes => {
pi.sell(newTx)