fix(timesheet): removed magic number
This commit is contained in:
parent
30f7179fe6
commit
4d2ed4714f
|
|
@ -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<Timesheets> {
|
||||
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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user