fix(findAll): fix loop for week_shifts
This commit is contained in:
parent
770ed8cf64
commit
eefe82153f
|
|
@ -1,4 +1,4 @@
|
|||
import { DayExpensesDto, DayShiftsDto, DetailedShifts, ShiftDto, TimesheetPeriodDto, WeekDto } from "../dtos/timesheet-period.dto";
|
||||
import { DayExpensesDto, DetailedShifts, ShiftDto, TimesheetPeriodDto, WeekDto } from "../dtos/timesheet-period.dto";
|
||||
|
||||
//makes the strings indexes for arrays
|
||||
export const DAY_KEYS = ['sun','mon','tue','wed','thu','fri','sat'] as const;
|
||||
|
|
@ -151,7 +151,7 @@ export function buildWeek(
|
|||
|
||||
//regroup hours per type of shifts
|
||||
const week_shifts = shifts.filter(shift => isBetweenUTC(shift.date, week_start, week_end));
|
||||
for (const shift of shifts) {
|
||||
for (const shift of week_shifts) {
|
||||
const key = dayKeyFromDate(shift.date, true);
|
||||
week.shifts[key].shifts.push({
|
||||
start: toTimeString(shift.start_time),
|
||||
|
|
@ -220,7 +220,7 @@ export function buildWeek(
|
|||
//daily totals
|
||||
const totals = day_amounts[key];
|
||||
const total_mileage = totals.mileage;
|
||||
const total_expense = totals.expense + totals.per_diem + totals.commission + totals.prime_dispo + totals.expense;
|
||||
const total_expense = totals.expense + totals.per_diem + totals.commission + totals.prime_dispo;
|
||||
|
||||
//pushing mileage rows
|
||||
for(const row of dayExpenseRows[key].km) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user