fix: cashbox batches log possible NaN and null values
This commit is contained in:
parent
03cb4a3c4c
commit
24807a70ef
1 changed files with 7 additions and 4 deletions
|
|
@ -72,22 +72,25 @@ function getBillsByBatchId (id) {
|
|||
function logFormatter (data) {
|
||||
return _.map(
|
||||
it => {
|
||||
const bills = _.filter(
|
||||
ite => !(_.isNil(ite) || _.isNil(ite.fiat_code) || _.isNil(ite.fiat) || _.isNaN(ite.fiat)),
|
||||
it.bills
|
||||
)
|
||||
return {
|
||||
id: it.id,
|
||||
deviceId: it.deviceId,
|
||||
created: it.created,
|
||||
operationType: it.operationType,
|
||||
performedBy: it.performedBy,
|
||||
billCount: _.size(it.bills),
|
||||
billCount: _.size(bills),
|
||||
fiatTotals: _.reduce(
|
||||
(acc, value) => {
|
||||
acc[value.fiat_code] = (acc[value.fiat_code] || 0) + value.fiat
|
||||
return acc
|
||||
},
|
||||
{},
|
||||
it.bills
|
||||
bills
|
||||
),
|
||||
billsByDenomination: _.countBy(ite => `${ite.fiat} ${ite.fiat_code}`, it.bills)
|
||||
billsByDenomination: _.countBy(ite => `${ite.fiat} ${ite.fiat_code}`, bills)
|
||||
}
|
||||
},
|
||||
data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue