Merge pull request #951 from josepfo/fix/max-number-of-cassette-value
fix: max nr of cassette value fallback
This commit is contained in:
commit
77f99ea8e8
5 changed files with 13 additions and 8 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 = [
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
|
|
|
|||
|
|
@ -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