fix: use the right field

This commit is contained in:
siiky 2022-11-25 15:39:18 +00:00
parent 0de24567bd
commit 99b2861ff8
2 changed files with 7 additions and 4 deletions

View file

@ -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,
_.defaultTo(notifications),
_.pick(fiatFields),
)(notifications.fiatBalanceOverrides)
return { ...notifNoOverrides, sms: smsSettings, email: emailSettings, ...cryptoSettings, ...fiatSettings, notificationCenter: notificationCenterSettings }
}