Merge pull request #951 from josepfo/fix/max-number-of-cassette-value

fix: max nr of cassette value fallback
This commit is contained in:
Rafael Taranto 2021-11-29 10:59:49 +00:00 committed by GitHub
commit 77f99ea8e8
5 changed files with 13 additions and 8 deletions

View file

@ -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 = [

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

@ -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),

View file

@ -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)

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 notesMin = 0