Merge branch 'main' of git.targo.ca:Targo/targo_backend into auth-session-fullstack

Something something
This commit is contained in:
Nicolas Drolet 2025-09-09 09:02:58 -04:00
commit 8e25e939af
2 changed files with 11 additions and 5 deletions

View File

@ -30,6 +30,8 @@ export class EmployeePeriodOverviewDto {
@ApiProperty({ example: 2, description: 'pay-period`s overtime hours' })
overtime_hours: number;
total_hours: number;
@ApiProperty({ example: 420.69, description: 'pay-period`s total expenses ($)' })
expenses: number;

View File

@ -203,6 +203,7 @@ export class PayPeriodsQueryService {
evening_hours: 0,
emergency_hours: 0,
overtime_hours: 0,
total_hours: 0,
expenses: 0,
mileage: 0,
is_approved: true,
@ -220,6 +221,7 @@ export class PayPeriodsQueryService {
evening_hours: 0,
emergency_hours: 0,
overtime_hours: 0,
total_hours: 0,
expenses: 0,
mileage: 0,
is_approved: true,
@ -235,8 +237,8 @@ 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?.type).toUpperCase();
switch (categorie) {
const type = (shift.bank_code?.type ?? '').toUpperCase();
switch (type) {
case "EVENING": record.evening_hours += hours; break;
case "EMERGENCY": record.emergency_hours += hours; break;
case "OVERTIME": record.overtime_hours += hours; break;
@ -244,6 +246,8 @@ export class PayPeriodsQueryService {
}
record.is_approved = record.is_approved && shift.timesheet.is_approved;
record.total_hours += hours;
record.is_remote = record.is_remote || !!shift.is_remote;
}
for (const expense of expenses) {
@ -260,10 +264,10 @@ export class PayPeriodsQueryService {
record.mileage += Math.round((amount / rate) * 100) / 100;
}
record.is_approved = record.is_approved && expense.timesheet.is_approved;
}
}
const employees_overview = Array.from(by_employee.values()).sort((a, b) =>
a.employee_name.localeCompare(b.employee_name, "fr", { sensitivity: "base" }),
const employees_overview = Array.from(by_employee.values()).sort((a, b) =>
a.employee_name.localeCompare(b.employee_name, "fr", { sensitivity: "base" }),
);
return {