fix(business-logics): small ajustments
This commit is contained in:
parent
4646b2f445
commit
bae8a037f7
|
|
@ -30,7 +30,7 @@ export class HolidayService {
|
||||||
const window_start = new Date(holiday_week_start.getTime() - 4 * MS_PER_WEEK);
|
const window_start = new Date(holiday_week_start.getTime() - 4 * MS_PER_WEEK);
|
||||||
const window_end = new Date(holiday_week_start.getTime() - 1);
|
const window_end = new Date(holiday_week_start.getTime() - 1);
|
||||||
|
|
||||||
const valid_codes = ['G1', 'G43', 'G56', 'G104', 'G105', 'G700'];
|
const valid_codes = ['G1', 'G43', 'G56', 'G104', 'G105', 'G305', 'G700'];
|
||||||
const shifts = await this.prisma.shifts.findMany({
|
const shifts = await this.prisma.shifts.findMany({
|
||||||
where: {
|
where: {
|
||||||
timesheet: { employee_id: employee_id },
|
timesheet: { employee_id: employee_id },
|
||||||
|
|
@ -67,7 +67,7 @@ export class HolidayService {
|
||||||
async calculateHolidayPay(email: string, holiday_date: Date, modifier: number): Promise<Result<number, string>> {
|
async calculateHolidayPay(email: string, holiday_date: Date, modifier: number): Promise<Result<number, string>> {
|
||||||
const average_daily_hours = await this.computeHoursPrevious4WeeksByEmail(email, holiday_date);
|
const average_daily_hours = await this.computeHoursPrevious4WeeksByEmail(email, holiday_date);
|
||||||
if (!average_daily_hours.success) return { success: false, error: average_daily_hours.error };
|
if (!average_daily_hours.success) return { success: false, error: average_daily_hours.error };
|
||||||
|
|
||||||
const daily_rate = (Math.min(average_daily_hours.data, 8)) * modifier;
|
const daily_rate = (Math.min(average_daily_hours.data, 8)) * modifier;
|
||||||
return { success: true, data: daily_rate };
|
return { success: true, data: daily_rate };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ type WeekOvertimeSummary = {
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class OvertimeService {
|
export class OvertimeService {
|
||||||
|
|
||||||
private INCLUDED_TYPES = ['EMERGENCY', 'EVENING', 'OVERTIME', 'REGULAR'] as const; // included types for weekly overtime calculation
|
private INCLUDED_TYPES = ['EMERGENCY', 'EVENING', 'OVERTIME', 'REGULAR', 'HOLIDAY'] as const; // included types for weekly overtime calculation
|
||||||
|
|
||||||
constructor(private prisma: PrismaService) { }
|
constructor(private prisma: PrismaService) { }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user