refactor: simplify bills handling code
This commit is contained in:
parent
317660e8d9
commit
7ba9332436
1 changed files with 5 additions and 6 deletions
|
|
@ -139,10 +139,9 @@ const CashCassettes = () => {
|
||||||
|
|
||||||
const timezone = R.path(['config', 'locale_timezone'], data)
|
const timezone = R.path(['config', 'locale_timezone'], data)
|
||||||
|
|
||||||
const bills = R.groupBy(bill => bill.deviceId)(R.path(['bills'])(data) ?? [])
|
const bills = data?.bills ?? []
|
||||||
const deviceIds = R.uniq(
|
const billsByDeviceID = R.groupBy(bill => bill.deviceId)(bills)
|
||||||
R.map(R.prop('deviceId'))(R.path(['bills'])(data) ?? []),
|
const deviceIds = R.keys(billsByDeviceID)
|
||||||
)
|
|
||||||
const cashout = data?.config && fromNamespace('cashOut')(data.config)
|
const cashout = data?.config && fromNamespace('cashOut')(data.config)
|
||||||
const locale = data?.config && fromNamespace('locale')(data.config)
|
const locale = data?.config && fromNamespace('locale')(data.config)
|
||||||
const fiatCurrency = locale?.fiatCurrency
|
const fiatCurrency = locale?.fiatCurrency
|
||||||
|
|
@ -195,7 +194,7 @@ const CashCassettes = () => {
|
||||||
const InnerCashUnitDetails = ({ it }) => (
|
const InnerCashUnitDetails = ({ it }) => (
|
||||||
<CashUnitDetails
|
<CashUnitDetails
|
||||||
machine={it}
|
machine={it}
|
||||||
bills={bills[it.id] ?? []}
|
bills={billsByDeviceID[it.id] ?? []}
|
||||||
currency={fiatCurrency}
|
currency={fiatCurrency}
|
||||||
config={config}
|
config={config}
|
||||||
/>
|
/>
|
||||||
|
|
@ -291,7 +290,7 @@ const CashCassettes = () => {
|
||||||
currencyCode={fiatCurrency}
|
currencyCode={fiatCurrency}
|
||||||
machines={machines}
|
machines={machines}
|
||||||
config={config}
|
config={config}
|
||||||
bills={R.path(['bills'])(data)}
|
bills={bills}
|
||||||
deviceIds={deviceIds}
|
deviceIds={deviceIds}
|
||||||
/>
|
/>
|
||||||
{wizard && (
|
{wizard && (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue