Merge pull request #1457 from siiky/fix/lam-609/fix-cashin-overrides
fix: use the right field
This commit is contained in:
commit
f1680cdced
2 changed files with 7 additions and 4 deletions
|
|
@ -93,7 +93,7 @@ const getNotifications = (cryptoCurrency, machine, config) => {
|
|||
const findByMachine = _.find(_.matches({ machine }))
|
||||
|
||||
const cryptoFields = ['cryptoHighBalance', 'cryptoLowBalance', 'highBalance', 'lowBalance']
|
||||
const fiatFields = ['cashbox', 'fillingPercentageCassette1', 'fillingPercentageCassette2', 'fillingPercentageCassette3', 'fillingPercentageCassette4']
|
||||
const fiatFields = ['cashInAlertThreshold', 'fillingPercentageCassette1', 'fillingPercentageCassette2', 'fillingPercentageCassette3', 'fillingPercentageCassette4']
|
||||
|
||||
const getCryptoSettings = _.compose(_.pick(cryptoFields), _.defaultTo(notifications), findByCryptoCurrency)
|
||||
const cryptoSettings = getCryptoSettings(notifications.cryptoBalanceOverrides)
|
||||
|
|
@ -108,8 +108,11 @@ const getNotifications = (cryptoCurrency, machine, config) => {
|
|||
delete cryptoSettings.lowBalance
|
||||
}
|
||||
|
||||
const getFiatSettings = _.compose(_.pick(fiatFields), _.defaultTo(notifications), findByMachine)
|
||||
const fiatSettings = getFiatSettings(notifications.fiatBalanceOverrides)
|
||||
const fiatSettings = _.flow(
|
||||
findByMachine,
|
||||
_.assignWith(_.defaultTo, notifications),
|
||||
_.pick(fiatFields),
|
||||
)(notifications.fiatBalanceOverrides)
|
||||
return { ...notifNoOverrides, sms: smsSettings, email: emailSettings, ...cryptoSettings, ...fiatSettings, notificationCenter: notificationCenterSettings }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { transformNumber } from 'src/utils/number'
|
|||
|
||||
import NotificationsCtx from '../NotificationsContext'
|
||||
|
||||
const CASHBOX_KEY = 'cashbox'
|
||||
const CASHBOX_KEY = 'cashInAlertThreshold'
|
||||
const CASSETTE_1_KEY = 'fillingPercentageCassette1'
|
||||
const CASSETTE_2_KEY = 'fillingPercentageCassette2'
|
||||
const CASSETTE_3_KEY = 'fillingPercentageCassette3'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue