fix: max nr of cassette value fallback
This commit is contained in:
parent
0a605e9346
commit
a5723b7779
5 changed files with 12 additions and 7 deletions
|
|
@ -37,7 +37,8 @@ const DenominationsSchema = Yup.object().shape({
|
||||||
|
|
||||||
const getElements = (machines, { fiatCurrency } = {}) => {
|
const getElements = (machines, { fiatCurrency } = {}) => {
|
||||||
const maxNumberOfCassettes = Math.max(
|
const maxNumberOfCassettes = Math.max(
|
||||||
...R.map(it => it.numberOfCassettes, machines)
|
...R.map(it => it.numberOfCassettes, machines),
|
||||||
|
0
|
||||||
)
|
)
|
||||||
|
|
||||||
const elements = [
|
const elements = [
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,8 @@ const MachinesTable = ({ machines, numToRender }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const maxNumberOfCassettes = Math.max(
|
const maxNumberOfCassettes = Math.max(
|
||||||
...R.map(it => it.numberOfCassettes, machines)
|
...R.map(it => it.numberOfCassettes, machines),
|
||||||
|
0
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,8 @@ const CashCassettes = () => {
|
||||||
const locale = data?.config && fromNamespace('locale')(data.config)
|
const locale = data?.config && fromNamespace('locale')(data.config)
|
||||||
const fiatCurrency = locale?.fiatCurrency
|
const fiatCurrency = locale?.fiatCurrency
|
||||||
const maxNumberOfCassettes = Math.max(
|
const maxNumberOfCassettes = Math.max(
|
||||||
...R.map(it => it.numberOfCassettes, machines)
|
...R.map(it => it.numberOfCassettes, machines),
|
||||||
|
0
|
||||||
)
|
)
|
||||||
const cashboxCounts = R.reduce(
|
const cashboxCounts = R.reduce(
|
||||||
(ret, m) => R.assoc(m.id, m.cashbox, ret),
|
(ret, m) => R.assoc(m.id, m.cashbox, ret),
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,14 @@ const FiatBalance = ({
|
||||||
setEditing,
|
setEditing,
|
||||||
data,
|
data,
|
||||||
save,
|
save,
|
||||||
machines
|
machines = []
|
||||||
} = useContext(NotificationsCtx)
|
} = useContext(NotificationsCtx)
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
|
|
||||||
const maxNumberOfCassettes =
|
const maxNumberOfCassettes = Math.max(
|
||||||
Math.max(...R.map(it => it.numberOfCassettes, machines)) ??
|
...R.map(it => it.numberOfCassettes, machines),
|
||||||
DEFAULT_NUMBER_OF_CASSETTES
|
DEFAULT_NUMBER_OF_CASSETTES
|
||||||
|
)
|
||||||
|
|
||||||
const editing = isEditing(NAME)
|
const editing = isEditing(NAME)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,8 @@ const FiatBalanceOverrides = ({ section }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const maxNumberOfCassettes = Math.max(
|
const maxNumberOfCassettes = Math.max(
|
||||||
...R.map(it => it.numberOfCassettes, machines)
|
...R.map(it => it.numberOfCassettes, machines),
|
||||||
|
0
|
||||||
)
|
)
|
||||||
|
|
||||||
const notesMin = 0
|
const notesMin = 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue