Merge pull request #975 from chaotixkilla/fix-cash-cassettes-wizard-nan-values
Fix cash cassettes wizard NaN values
This commit is contained in:
commit
e9f033d915
2 changed files with 9 additions and 9 deletions
|
|
@ -3,6 +3,7 @@ import React, { useState } from 'react'
|
|||
import * as Yup from 'yup'
|
||||
|
||||
import Modal from 'src/components/Modal'
|
||||
import { defaultToZero } from 'src/utils/number.js'
|
||||
|
||||
import WizardSplash from './WizardSplash'
|
||||
import WizardStep from './WizardStep'
|
||||
|
|
@ -34,15 +35,11 @@ const Wizard = ({ machine, cashoutSettings, locale, onClose, save, error }) => {
|
|||
|
||||
const cashbox = wasCashboxEmptied ? 0 : machine?.cashbox
|
||||
|
||||
const { cassette1, cassette2, cassette3, cassette4 } = R.map(parseInt, it)
|
||||
save(
|
||||
machine.id,
|
||||
cashbox,
|
||||
cassette1 ?? 0,
|
||||
cassette2 ?? 0,
|
||||
cassette3 ?? 0,
|
||||
cassette4 ?? 0
|
||||
const { cassette1, cassette2, cassette3, cassette4 } = R.map(
|
||||
defaultToZero,
|
||||
it
|
||||
)
|
||||
save(machine.id, cashbox, cassette1, cassette2, cassette3, cassette4)
|
||||
return onClose()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,4 +4,7 @@ const isValidNumber = R.both(R.is(Number), R.complement(R.equals(NaN)))
|
|||
|
||||
const transformNumber = value => (isValidNumber(value) ? value : null)
|
||||
|
||||
export { transformNumber }
|
||||
const defaultToZero = value =>
|
||||
isValidNumber(parseInt(value)) ? parseInt(value) : 0
|
||||
|
||||
export { transformNumber, defaultToZero }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue