fix(shifts): fix overlaping logic

This commit is contained in:
Matthieu Haineault 2025-11-04 09:41:46 -05:00
parent 3741bf3b26
commit c2203f77cb

View File

@ -187,8 +187,23 @@ export class ShiftsUpsertService {
select: shift_select,
});
existing.push({ start_time: row.start_time, end_time: row.end_time });
existing_map.set(map_key, existing);
const normalizeHHmm = (value: Date) => toHHmmFromString(toStringFromHHmm(value));
for (const { timesheet_id, day, key } of timesheet_keys) {
const day_date = new Date(day);
existing.push({
start_time: normalizeHHmm(row.start_time),
end_time: normalizeHHmm(row.end_time)
});
existing_map.set(
key,
existing.map(row => ({
start_time: normalizeHHmm(row.start_time),
end_time: normalizeHHmm(row.end_time),
})),
);
}
const {type: bank_type} = await this.typeResolver.findTypeByBankCodeId(row.bank_code_id);
const summary = await this.overtime.getWeekOvertimeSummary(timesheet_id, normed.date, tx);