From c170481f3b8e4551cacf9132bc009bcf7e104c3b Mon Sep 17 00:00:00 2001 From: Matthieu Haineault Date: Fri, 29 Aug 2025 13:16:58 -0400 Subject: [PATCH] fix(pay-period): switch filters from categorie to type --- .../pay-periods/services/pay-periods-query.service.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/modules/pay-periods/services/pay-periods-query.service.ts b/src/modules/pay-periods/services/pay-periods-query.service.ts index f0f306a..e6e18e6 100644 --- a/src/modules/pay-periods/services/pay-periods-query.service.ts +++ b/src/modules/pay-periods/services/pay-periods-query.service.ts @@ -40,6 +40,7 @@ export class PayPeriodsQueryService { } as any); } + //find crew member associated with supervisor private async resolveCrew(supervisor_id: number, include_subtree: boolean): Promise> { const result: Array<{ id: number; first_name: string; last_name: string; email: string; }> = []; @@ -69,6 +70,7 @@ export class PayPeriodsQueryService { return result; } + //fetchs crew emails async resolveCrewEmails(supervisor_id: number, include_subtree: boolean): Promise> { const crew = await this.resolveCrew(supervisor_id, include_subtree); return new Set(crew.map(crew_member => crew_member.email).filter(Boolean)); @@ -161,7 +163,7 @@ export class PayPeriodsQueryService { } }, }, }, - bank_code: { select: { categorie: true } }, + bank_code: { select: { categorie: true, type: true } }, }, }); @@ -184,7 +186,7 @@ export class PayPeriodsQueryService { } }, } }, } }, - bank_code: { select: { categorie: true, modifier: true } }, + bank_code: { select: { categorie: true, modifier: true, type: true } }, }, }); @@ -230,12 +232,12 @@ export class PayPeriodsQueryService { const record = ensure(employee.id, name, employee.user.email); const hours = computeHours(shift.start_time, shift.end_time); - const categorie = (shift.bank_code?.categorie || "REGULAR").toUpperCase(); + const categorie = (shift.bank_code?.type).toUpperCase(); switch (categorie) { case "EVENING": record.evening_hours += hours; break; case "EMERGENCY": record.emergency_hours += hours; break; case "OVERTIME": record.overtime_hours += hours; break; - default: record.regular_hours += hours; break; + case "REGULAR" : record.regular_hours += hours; break; } record.is_approved = record.is_approved && shift.timesheet.is_approved; }