Resilliance und bessere erkennung ausgefüllte tage
This commit is contained in:
@@ -94,6 +94,7 @@ function getCurrentOvertimeForUser(userId, db, callback) {
|
||||
const endDate = new Date(week.week_end);
|
||||
let workdays = 0;
|
||||
let filledWorkdays = 0;
|
||||
const fullDayHoursForCheck = wochenstunden > 0 && arbeitstage > 0 ? wochenstunden / arbeitstage : 8;
|
||||
|
||||
for (let d = new Date(startDate); d <= endDate; d.setDate(d.getDate() + 1)) {
|
||||
const day = d.getDay();
|
||||
@@ -108,12 +109,14 @@ function getCurrentOvertimeForUser(userId, db, callback) {
|
||||
if (entry) {
|
||||
const isFullDayVacation = entry.vacation_type === 'full';
|
||||
const isSick = entry.sick_status === 1 || entry.sick_status === true;
|
||||
const overtimeValue = entry.overtime_taken_hours ? parseFloat(entry.overtime_taken_hours) : 0;
|
||||
const isFullDayOvertime = overtimeValue > 0 && Math.abs(overtimeValue - fullDayHoursForCheck) < 0.01;
|
||||
const hasStartAndEnd =
|
||||
entry.start_time &&
|
||||
entry.end_time &&
|
||||
entry.start_time.toString().trim() !== '' &&
|
||||
entry.end_time.toString().trim() !== '';
|
||||
if (isFullDayVacation || isSick || hasStartAndEnd) {
|
||||
if (isFullDayVacation || isSick || isFullDayOvertime || hasStartAndEnd) {
|
||||
filledWorkdays++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user