fix(holiday): fixed the valid codes for the holiday calculations
This commit is contained in:
parent
d004fa9fa2
commit
b1069c0add
|
|
@ -30,23 +30,16 @@ export class HolidayService {
|
|||
holiday_date: Date
|
||||
): Promise<Result<number, string>> {
|
||||
try {
|
||||
const valid_codes = ['G1', 'G43', 'G140', 'G104', 'G105', 'G305', 'G700', 'G720'];
|
||||
const valid_codes = ['G1', 'G43', 'G48', 'G104', 'G105', 'G109', 'G140', 'G720'];
|
||||
const holiday_week_start = getWeekStart(holiday_date);
|
||||
const window_start = new Date(holiday_week_start.getTime() - 4 * MS_PER_WEEK);
|
||||
const window_end = new Date(holiday_week_start.getTime() - 1);
|
||||
|
||||
const employee = await this.prisma.employees.findFirst({
|
||||
where: {
|
||||
external_payroll_id,
|
||||
company_code,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
}
|
||||
where: { external_payroll_id, company_code }
|
||||
});
|
||||
|
||||
if (!employee)
|
||||
return { success: false, error: 'EMPLOYEE_NOT_FOUND' };
|
||||
if (!employee) return { success: false, error: 'EMPLOYEE_NOT_FOUND' };
|
||||
|
||||
const shifts = await this.prisma.shifts.findMany({
|
||||
where: {
|
||||
|
|
@ -61,8 +54,7 @@ export class HolidayService {
|
|||
for (const shift of shifts) {
|
||||
const hours = computeHours(shift.start_time, shift.end_time);
|
||||
|
||||
if (hours <= 0)
|
||||
continue;
|
||||
if (hours <= 0) continue;
|
||||
|
||||
const shift_week_start = getWeekStart(shift.date);
|
||||
const key = shift_week_start.getTime();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user