fix: query and function name

This commit is contained in:
Sérgio Salgado 2021-01-05 14:44:49 +00:00 committed by Josh Harvey
parent 8f264e25b0
commit 772805269f

View file

@ -190,9 +190,9 @@ function plugins (settings, deviceId) {
.then(row => row.id)
}
function fetchCurrentAvailableCoupons () {
const sql = `SELECT * FROM coupons WHERE soft_deleted=false`
return db.any(sql).then(v => v.length)
function getNumberOfAvailableCoupons () {
const sql = `SELECT COUNT(id) FROM coupons WHERE soft_deleted=false`
return db.one(sql).then(res => res.count)
}
function mapCoinSettings (coinParams) {
@ -227,7 +227,7 @@ function plugins (settings, deviceId) {
const testnetPromises = cryptoCodes.map(c => wallet.cryptoNetwork(settings, c))
const pingPromise = recordPing(deviceTime, machineVersion, machineModel)
const currentConfigVersionPromise = fetchCurrentConfigVersion()
const currentAvailableCoupons = fetchCurrentAvailableCoupons()
const currentAvailableCoupons = getNumberOfAvailableCoupons()
const promises = [
buildAvailableCassettes(),