fix(exports): fix issue where bank code was not being properly verified, adjust sorting of results

This commit is contained in:
Nic D 2026-02-18 11:59:27 -05:00
parent aa6109ff09
commit c712e0f5db
2 changed files with 7 additions and 10 deletions

View File

@ -11,10 +11,10 @@ export const consolidateRowHoursAndAmountByType = (rows: InternalCsvRow[]): Inte
const map = new Map<string, InternalCsvRow>();
for (const row of rows) {
if (row.code = VACATION) {
map.set(`${row.code}|${row.shift_date}`, row);
if (row.code === VACATION) {
map.set(`${row.code}|${row.shift_date}|${row.timesheet_id}`, row);
} else {
const key = `${row.code}|${row.semaine_no}`;
const key = `${row.code}|${row.timesheet_id}`;
if (!map.has(key)) {
map.set(key, row);
} else {

View File

@ -135,16 +135,13 @@ export class CsvExportService {
dernier_jour_absence: undefined,
});
});
}
// Sort shifts and expenses according to their bank codes
rows.sort((a, b) => {
if (a.code !== b.code)
return a.code - b.code;
return 0;
});
rows.sort((a, b) =>
a.code - b.code ||
a.employee_matricule - b.employee_matricule
);
const holiday_rows = await applyHolidayRequalifications(rows, this.holiday_service, HOLIDAY_SHIFT_CODE[0]);
const consolidated_rows = await consolidateRowHoursAndAmountByType(holiday_rows);