This commit is contained in:
Josh Harvey 2016-12-09 01:03:33 +02:00
parent 1b89ed5c76
commit 2355054cdc
3 changed files with 20 additions and 21 deletions

View file

@ -88,7 +88,7 @@ function plugins (settings) {
}
function fetchCurrentConfigVersion () {
const sql = `select id from config_users
const sql = `select id from user_config
where type=$1
order by id desc
limit 1`
@ -425,6 +425,14 @@ function plugins (settings) {
})
}
function checkBalance (settings, rec) {
const config = configManager.unscoped(settings.config)
const lowBalanceThreshold = config.lowBalanceThreshold
return lowBalanceThreshold && rec.fiatBalance < lowBalanceThreshold
? {code: 'lowBalance', cryptoCode: rec.cryptoCode, fiatBalance: rec.fiatBalance, fiatCode: rec.fiatCode}
: null
}
function checkBalances () {
return dbm.devices()
.then(devices => {
@ -438,6 +446,7 @@ function plugins (settings) {
return R.values(R.reduceBy(min, Infinity, toMarket, R.flatten(arr)))
})
})
.then(balances => R.reject(R.isNil, balances.map(balance => checkBalance)))
}
function randomCode () {