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' },
|
orderBy: { date: 'asc' },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const to_num = (value: any) => value && typeof (value as any).toNumber === 'function'
|
||||||
|
? (value as any).toNumber()
|
||||||
|
: Number(value);
|
||||||
|
|
||||||
// data mapping
|
// data mapping
|
||||||
const shifts: ShiftRow[] = raw_shifts.map(shift => ({
|
const shifts: ShiftRow[] = raw_shifts.map(shift => ({
|
||||||
date: shift.date,
|
date: shift.date,
|
||||||
|
|
@ -87,8 +91,7 @@ export class TimesheetsQueryService {
|
||||||
|
|
||||||
const expenses: ExpenseRow[] = raw_expenses.map(expense => ({
|
const expenses: ExpenseRow[] = raw_expenses.map(expense => ({
|
||||||
date: expense.date,
|
date: expense.date,
|
||||||
amount: typeof (expense.amount as any)?.to_num === 'function' ?
|
amount: to_num(expense.amount),
|
||||||
(expense.amount as any).to_num() : Number(expense.amount),
|
|
||||||
type: String(expense.bank_code?.type ?? '').toUpperCase(),
|
type: String(expense.bank_code?.type ?? '').toUpperCase(),
|
||||||
is_approved: expense.is_approved ?? true,
|
is_approved: expense.is_approved ?? true,
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user