diff --git a/src/modules/timesheets/utils/timesheet.helpers.ts b/src/modules/timesheets/utils/timesheet.helpers.ts index c36a4c4..c94d64d 100644 --- a/src/modules/timesheets/utils/timesheet.helpers.ts +++ b/src/modules/timesheets/utils/timesheet.helpers.ts @@ -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), @@ -164,7 +164,7 @@ export function buildWeek( const duration = Math.max(0, (shift.end_time.getTime() - shift.start_time.getTime())/ MS_PER_HOUR); const type = (shift.type || '').toUpperCase(); - if (type === SHIFT_TYPES.REGULAR) day_hours[key].regular += duration; + if ( type === SHIFT_TYPES.REGULAR) day_hours[key].regular += duration; else if( type === SHIFT_TYPES.EVENING) day_hours[key].evening += duration; else if( type === SHIFT_TYPES.EMERGENCY) day_hours[key].emergency += duration; else if( type === SHIFT_TYPES.OVERTIME) day_hours[key].overtime += duration; @@ -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) {