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 maxNumberOfCassettes = Math.max(
|
||||
...R.map(it => it.numberOfCassettes, machines)
|
||||
...R.map(it => it.numberOfCassettes, machines),
|
||||
0
|
||||
)
|
||||
|
||||
const elements = [
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
|
|
|
|||
|
|
@ -142,7 +142,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),
|
||||
|
|
|
|||
|
|
@ -32,13 +32,14 @@ const FiatBalance = ({
|
|||
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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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 notesMin = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue