diff --git a/src/modules/timesheets/services/timesheets-query.service.ts b/src/modules/timesheets/services/timesheets-query.service.ts index 82e0fae..39e71c8 100644 --- a/src/modules/timesheets/services/timesheets-query.service.ts +++ b/src/modules/timesheets/services/timesheets-query.service.ts @@ -8,6 +8,8 @@ import { computeHours } from 'src/common/utils/date-utils'; import { buildPrismaWhere } from 'src/common/shared/build-prisma-where'; import { SearchTimesheetDto } from '../dtos/search-timesheet.dto'; +const ROUND_TO = 5; + @Injectable() export class TimesheetsQueryService { constructor( @@ -15,6 +17,8 @@ export class TimesheetsQueryService { private readonly overtime: OvertimeService, ) {} + + async create(dto : CreateTimesheetDto): Promise { const { employee_id, is_approved } = dto; return this.prisma.timesheets.create({ @@ -42,7 +46,7 @@ export class TimesheetsQueryService { rawlist.map(async timesheet => { //detailed shifts const detailedShifts = timesheet.shift.map(shift => { - const totalhours = computeHours(shift.start_time, shift.end_time,5); + const totalhours = computeHours(shift.start_time, shift.end_time, ROUND_TO); const regularHours = Math.min(8, totalhours); const dailyOvertime = this.overtime.getDailyOvertimeHours(shift.start_time, shift.end_time); const payRegular = regularHours * shift.bank_code.modifier;