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 308caa7..8e0a952 100644 --- a/src/modules/pay-periods/services/pay-periods-query.service.ts +++ b/src/modules/pay-periods/services/pay-periods-query.service.ts @@ -252,6 +252,7 @@ export class PayPeriodsQueryService { record.total_hours += hours; break; } + record.is_approved = record.is_approved && shift.timesheet.is_approved; record.is_remote = record.is_remote || !!shift.is_remote; } @@ -267,7 +268,7 @@ export class PayPeriodsQueryService { const type = (expense.bank_code?.type || "").toUpperCase(); const rate = expense.bank_code?.modifier ?? 0; if (type === "MILEAGE" && rate > 0) { - record.mileage += Math.round((amount / rate)/100)*100; + record.mileage += Math.round((amount / rate) * 100) / 100; } record.is_approved = record.is_approved && expense.timesheet.is_approved; } diff --git a/src/modules/timesheets/services/timesheets-query.service.ts b/src/modules/timesheets/services/timesheets-query.service.ts index edbc830..5050e4e 100644 --- a/src/modules/timesheets/services/timesheets-query.service.ts +++ b/src/modules/timesheets/services/timesheets-query.service.ts @@ -23,10 +23,21 @@ export class TimesheetsQueryService { user: { is: { email } } }, select: { - id: true + id: true, + user_id: true, }, }); if(!employee) throw new NotFoundException(`no employee with email ${email} found`); + + //gets the employee's full name + const user = await this.prisma.users.findFirst({ + where: { id: employee.user_id }, + select: { + first_name: true, + last_name: true, + } + }); + const employee_full_name: string = ( user?.first_name + " " + user?.last_name ) || " "; //finds the period const period = await this.prisma.payPeriods.findFirst({ @@ -104,7 +115,7 @@ export class TimesheetsQueryService { supervisor_comment: expense.supervisor_comment ?? '', })); - return buildPeriod(period.period_start, period.period_end, shifts , expenses); + return buildPeriod(period.period_start, period.period_end, shifts , expenses, employee_full_name); } async getTimesheetByEmail(email: string, week_offset = 0): Promise {