diff --git a/dev/notify.js b/dev/notify.js index 5d3dd3f1..6f3b849c 100644 --- a/dev/notify.js +++ b/dev/notify.js @@ -7,7 +7,7 @@ var db = require('../lib/postgresql_interface') function getBalances () { return [ {fiatBalance: 23.2345, fiatCode: 'USD', cryptoCode: 'BTC'}, - {fiatBalance: 22, fiatCode: 'USD', cryptoCode: 'ETH'} + {fiatBalance: 23, fiatCode: 'USD', cryptoCode: 'ETH'} ] } diff --git a/lib/notifier.js b/lib/notifier.js index faa6df7e..1efb558b 100644 --- a/lib/notifier.js +++ b/lib/notifier.js @@ -5,7 +5,7 @@ var numeral = require('numeral') var db = null var getBalances = null -var LOW_BALANCE_THRESHOLD = 1000 +var LOW_BALANCE_THRESHOLD = null var STALE_STATE = 2 * 60 * 1000 var NETWORK_DOWN_TIME = 60 * 1000 @@ -13,6 +13,8 @@ function init (_db, _getBalances, config) { db = _db getBalances = _getBalances + console.log('DEBUG2') + console.log(config) if (config && config.lowBalanceThreshold) { LOW_BALANCE_THRESHOLD = config.lowBalanceThreshold } @@ -30,7 +32,7 @@ function sameState (a, b) { } function checkBalance (rec) { - return rec.fiatBalance < LOW_BALANCE_THRESHOLD + return LOW_BALANCE_THRESHOLD && rec.fiatBalance < LOW_BALANCE_THRESHOLD ? {code: 'lowBalance', cryptoCode: rec.cryptoCode, fiatBalance: rec.fiatBalance, fiatCode: rec.fiatCode} : null }