fix: remove duplicated createBatch() calls
fix: rename cassetteMaxCapacity to snake uppercase fix: notification module retrieving the wrong override fields
This commit is contained in:
parent
31dcf890de
commit
15e0182ba1
7 changed files with 19 additions and 39 deletions
|
|
@ -1,6 +1,6 @@
|
|||
const _ = require('lodash/fp')
|
||||
const { saveConfig, loadLatest } = require('../lib/new-settings-loader')
|
||||
const { cassetteMaxCapacity } = require('../lib/constants')
|
||||
const { CASSETTE_MAX_CAPACITY } = require('../lib/constants')
|
||||
|
||||
exports.up = function (next) {
|
||||
return loadLatest()
|
||||
|
|
@ -12,19 +12,19 @@ exports.up = function (next) {
|
|||
const overrides = config.notifications_fiatBalanceOverrides
|
||||
const newConfig = {}
|
||||
if (fiatBalance1) {
|
||||
newConfig.notifications_fillingPercentageCassette1 = (100 * (fiatBalance1 / cassetteMaxCapacity)).toFixed(0)
|
||||
newConfig.notifications_fillingPercentageCassette1 = (100 * (fiatBalance1 / CASSETTE_MAX_CAPACITY)).toFixed(0)
|
||||
newConfig.notifications_fiatBalanceCassette1 = null
|
||||
}
|
||||
if (fiatBalance2) {
|
||||
newConfig.notifications_fillingPercentageCassette2 = (100 * (fiatBalance2 / cassetteMaxCapacity)).toFixed(0)
|
||||
newConfig.notifications_fillingPercentageCassette2 = (100 * (fiatBalance2 / CASSETTE_MAX_CAPACITY)).toFixed(0)
|
||||
newConfig.notifications_fiatBalanceCassette2 = null
|
||||
}
|
||||
if (fiatBalance3) {
|
||||
newConfig.notifications_fillingPercentageCassette3 = (100 * (fiatBalance3 / cassetteMaxCapacity)).toFixed(0)
|
||||
newConfig.notifications_fillingPercentageCassette3 = (100 * (fiatBalance3 / CASSETTE_MAX_CAPACITY)).toFixed(0)
|
||||
newConfig.notifications_fiatBalanceCassette3 = null
|
||||
}
|
||||
if (fiatBalance4) {
|
||||
newConfig.notifications_fillingPercentageCassette4 = (100 * (fiatBalance4 / cassetteMaxCapacity)).toFixed(0)
|
||||
newConfig.notifications_fillingPercentageCassette4 = (100 * (fiatBalance4 / CASSETTE_MAX_CAPACITY)).toFixed(0)
|
||||
newConfig.notifications_fiatBalanceCassette4 = null
|
||||
}
|
||||
|
||||
|
|
@ -32,16 +32,16 @@ exports.up = function (next) {
|
|||
newConfig.notifications_fiatBalanceOverrides = _.map(override => {
|
||||
const newOverride = {}
|
||||
if (override.fiatBalanceCassette1) {
|
||||
newOverride.fillingPercentageCassette1 = (100 * (override.fiatBalanceCassette1 / cassetteMaxCapacity)).toFixed(0)
|
||||
newOverride.fillingPercentageCassette1 = (100 * (override.fiatBalanceCassette1 / CASSETTE_MAX_CAPACITY)).toFixed(0)
|
||||
}
|
||||
if (override.fiatBalanceCassette2) {
|
||||
newOverride.fillingPercentageCassette2 = (100 * (override.fiatBalanceCassette2 / cassetteMaxCapacity)).toFixed(0)
|
||||
newOverride.fillingPercentageCassette2 = (100 * (override.fiatBalanceCassette2 / CASSETTE_MAX_CAPACITY)).toFixed(0)
|
||||
}
|
||||
if (override.fiatBalanceCassette3) {
|
||||
newOverride.fillingPercentageCassette3 = (100 * (override.fiatBalanceCassette3 / cassetteMaxCapacity)).toFixed(0)
|
||||
newOverride.fillingPercentageCassette3 = (100 * (override.fiatBalanceCassette3 / CASSETTE_MAX_CAPACITY)).toFixed(0)
|
||||
}
|
||||
if (override.fiatBalanceCassette4) {
|
||||
newOverride.fillingPercentageCassette4 = (100 * (override.fiatBalanceCassette4 / cassetteMaxCapacity)).toFixed(0)
|
||||
newOverride.fillingPercentageCassette4 = (100 * (override.fiatBalanceCassette4 / CASSETTE_MAX_CAPACITY)).toFixed(0)
|
||||
}
|
||||
newOverride.machine = override.machine
|
||||
newOverride.id = override.id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue