fix(timesheets): fix query to use helper instead of library function
This commit is contained in:
parent
a73ed4b620
commit
dac53c6780
|
|
@ -76,6 +76,10 @@ export class TimesheetsQueryService {
|
|||
orderBy: { date: 'asc' },
|
||||
});
|
||||
|
||||
const to_num = (value: any) => value && typeof (value as any).toNumber === 'function'
|
||||
? (value as any).toNumber()
|
||||
: Number(value);
|
||||
|
||||
// data mapping
|
||||
const shifts: ShiftRow[] = raw_shifts.map(shift => ({
|
||||
date: shift.date,
|
||||
|
|
@ -87,8 +91,7 @@ export class TimesheetsQueryService {
|
|||
|
||||
const expenses: ExpenseRow[] = raw_expenses.map(expense => ({
|
||||
date: expense.date,
|
||||
amount: typeof (expense.amount as any)?.to_num === 'function' ?
|
||||
(expense.amount as any).to_num() : Number(expense.amount),
|
||||
amount: to_num(expense.amount),
|
||||
type: String(expense.bank_code?.type ?? '').toUpperCase(),
|
||||
is_approved: expense.is_approved ?? true,
|
||||
}));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user