Merge pull request #949 from josepfo/fix/initial-wizard-breaks-upon-choosing-exchange

Fix: initial wizard breaks upon choosing exchange
This commit is contained in:
Rafael Taranto 2021-11-29 10:59:42 +00:00 committed by GitHub
commit bbde0fc2b6
6 changed files with 14 additions and 9 deletions

View file

@ -41,7 +41,8 @@ const DenominationsSchema = Yup.object().shape({
const getElements = (machines, locale = {}, classes) => {
const fiatCurrency = R.prop('fiatCurrency')(locale)
const maxNumberOfCassettes = Math.max(
...R.map(it => it.numberOfCassettes, machines)
...R.map(it => it.numberOfCassettes, machines),
0
)
const options = getBillOptions(locale, denominations)

View file

@ -40,7 +40,7 @@ const HeaderCell = withStyles({
}
})(TableCell)
const MachinesTable = ({ machines, numToRender }) => {
const MachinesTable = ({ machines = [], numToRender }) => {
const classes = useStyles()
const history = useHistory()
const getPercent = (notes, capacity = 500) => {
@ -62,7 +62,8 @@ const MachinesTable = ({ machines, numToRender }) => {
}
const maxNumberOfCassettes = Math.max(
...R.map(it => it.numberOfCassettes, machines)
...R.map(it => it.numberOfCassettes, machines),
0
)
return (

View file

@ -160,7 +160,8 @@ const CashCassettes = () => {
const locale = data?.config && fromNamespace('locale')(data.config)
const fiatCurrency = locale?.fiatCurrency
const maxNumberOfCassettes = Math.max(
...R.map(it => it.numberOfCassettes, machines)
...R.map(it => it.numberOfCassettes, machines),
0
)
const cashboxCounts = R.reduce(
(ret, m) => R.assoc(m.id, m.cashbox, ret),

View file

@ -27,13 +27,14 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
setEditing,
data,
save,
machines
machines = []
} = useContext(NotificationsCtx)
const classes = useStyles()
const maxNumberOfCassettes =
Math.max(...R.map(it => it.numberOfCassettes, machines)) ??
const maxNumberOfCassettes = Math.max(
...R.map(it => it.numberOfCassettes, machines),
DEFAULT_NUMBER_OF_CASSETTES
)
const editing = isEditing(NAME)

View file

@ -56,7 +56,8 @@ const FiatBalanceOverrides = ({ section }) => {
}
const maxNumberOfCassettes = Math.max(
...R.map(it => it.numberOfCassettes, machines)
...R.map(it => it.numberOfCassettes, machines),
0
)
const percentMin = 0

View file

@ -38,7 +38,7 @@ const SAVE_ACCOUNTS = gql`
}
`
const isConfigurable = it => !R.contains(it)(['mock-exchange'])
const isConfigurable = it => !R.isNil(it) && !R.contains(it)(['mock-exchange'])
const ChooseExchange = ({ data: currentData, addData }) => {
const classes = useStyles()