txId bug fixes; debugging

This commit is contained in:
Josh Harvey 2016-07-29 18:44:26 +03:00
parent 572bd7a10f
commit 3d9c95ba7f
4 changed files with 20 additions and 11 deletions

View file

@ -42,6 +42,7 @@ exports.init = function init (conString) {
// logs inputted bill and overall tx status (if available)
exports.recordBill = function recordBill (deviceId, rec) {
console.log('DEBUG10: %j', rec)
const fields = [
'id',
'device_id',
@ -66,6 +67,8 @@ exports.recordBill = function recordBill (deviceId, rec) {
rec.fiat
]
console.log('DEBUG11: %j', values)
return db.none(getInsertQuery('bills', fields), values)
.catch(err => {
if (isUniqueViolation(err)) return logger.warn('Attempt to report bill twice')