db bug fix; sweep fixes

This commit is contained in:
Josh Harvey 2016-06-02 22:21:58 +03:00
parent 44188aa5ba
commit 751067bace
3 changed files with 17 additions and 24 deletions

View file

@ -424,7 +424,7 @@ exports.cacheResponse = function (session, path, method, body) {
exports.nextCashOutSerialHD = function nextCashOutSerialHD (sessionId, cryptoCode) {
const sql = `select hd_serial from cash_out_hds
where crypto_code=$1 order by hd_serial desc limit 1`
const attempt = db.oneOrNone(sql, [cryptoCode])
const attempt = () => db.oneOrNone(sql, [cryptoCode])
.then(row => {
const serialNumber = row ? row.hd_serial + 1 : 0
const fields2 = ['session_id', 'crypto_code', 'hd_serial']