feat: remove stacker count override from cassettes wizard

This commit is contained in:
Sérgio Salgado 2023-05-30 16:11:47 +01:00
parent 266eb44076
commit ab4fa10fb3

View file

@ -39,7 +39,8 @@ const Wizard = ({ machine, cashoutSettings, locale, onClose, save, error }) => {
const numberOfCassettes = isCashOutDisabled ? 0 : machine.numberOfCassettes const numberOfCassettes = isCashOutDisabled ? 0 : machine.numberOfCassettes
const numberOfStackers = machine.numberOfStackers const numberOfStackers = machine.numberOfStackers
const LAST_STEP = numberOfCassettes + numberOfStackers * 2 + 1 // const LAST_STEP = numberOfCassettes + numberOfStackers * 2 + 1
const LAST_STEP = numberOfCassettes + 1
const title = `Update counts` const title = `Update counts`
const isLastStep = step === LAST_STEP const isLastStep = step === LAST_STEP
@ -58,7 +59,8 @@ const Wizard = ({ machine, cashoutSettings, locale, onClose, save, error }) => {
const buildStackerObj = cassetteInput => { const buildStackerObj = cassetteInput => {
return R.reduce( return R.reduce(
(acc, value) => { (acc, value) => {
acc[value] = defaultToZero(cassetteInput[value]) acc[value] = machine.cashUnits[value]
// acc[value] = defaultToZero(cassetteInput[value])
return acc return acc
}, },
{}, {},
@ -115,57 +117,57 @@ const Wizard = ({ machine, cashoutSettings, locale, onClose, save, error }) => {
})) }))
) )
const makeStackerSteps = R.pipe( // const makeStackerSteps = R.pipe(
R.add(1), // R.add(1),
R.range(1), // R.range(1),
R.chain(i => [ // R.chain(i => [
{ // {
type: `stacker ${i}f`, // type: `stacker ${i}f`,
schema: Yup.object().shape({ // schema: Yup.object().shape({
[`stacker${i}f`]: Yup.number() // [`stacker${i}f`]: Yup.number()
.label('Bill count') // .label('Bill count')
.positive() // .positive()
.integer() // .integer()
.required() // .required()
.min(0) // .min(0)
.max( // .max(
i === 1 // i === 1
? cashUnitCapacity[machine.model].stacker - // ? cashUnitCapacity[machine.model].stacker -
cashUnitCapacity[machine.model].escrow // cashUnitCapacity[machine.model].escrow
: cashUnitCapacity[machine.model].stacker, // : cashUnitCapacity[machine.model].stacker,
i === 1 // i === 1
? `${ // ? `${
modelPrettifier[machine.model] // modelPrettifier[machine.model]
} maximum stacker capacity for the escrow unit is ${cashUnitCapacity[ // } maximum stacker capacity for the escrow unit is ${cashUnitCapacity[
machine.model // machine.model
].stacker - cashUnitCapacity[machine.model].escrow} bills` // ].stacker - cashUnitCapacity[machine.model].escrow} bills`
: `${ // : `${
modelPrettifier[machine.model] // modelPrettifier[machine.model]
} maximum stacker capacity is ${ // } maximum stacker capacity is ${
cashUnitCapacity[machine.model].stacker // cashUnitCapacity[machine.model].stacker
} bills` // } bills`
) // )
}) // })
}, // },
{ // {
type: `stacker ${i}r`, // type: `stacker ${i}r`,
schema: Yup.object().shape({ // schema: Yup.object().shape({
[`stacker${i}r`]: Yup.number() // [`stacker${i}r`]: Yup.number()
.label('Bill count') // .label('Bill count')
.positive() // .positive()
.integer() // .integer()
.required() // .required()
.min(0) // .min(0)
.max( // .max(
cashUnitCapacity[machine.model].stacker, // cashUnitCapacity[machine.model].stacker,
`${modelPrettifier[machine.model]} maximum stacker capacity is ${ // `${modelPrettifier[machine.model]} maximum stacker capacity is ${
cashUnitCapacity[machine.model].stacker // cashUnitCapacity[machine.model].stacker
} bills` // } bills`
) // )
}) // })
} // }
]) // ])
) // )
const makeCassettesInitialValues = () => const makeCassettesInitialValues = () =>
!R.isEmpty(cashoutSettings) !R.isEmpty(cashoutSettings)
@ -196,7 +198,7 @@ const Wizard = ({ machine, cashoutSettings, locale, onClose, save, error }) => {
R.merge(makeCassettesInitialValues(), makeStackersInitialValues()) R.merge(makeCassettesInitialValues(), makeStackersInitialValues())
const steps = R.pipe( const steps = R.pipe(
R.concat(makeStackerSteps(numberOfStackers)), // R.concat(makeStackerSteps(numberOfStackers)),
R.concat(makeCassetteSteps(numberOfCassettes)), R.concat(makeCassetteSteps(numberOfCassettes)),
R.concat([ R.concat([
{ {