Resilliance und bessere erkennung ausgefüllte tage
This commit is contained in:
@@ -393,6 +393,7 @@ function registerUserRoutes(app) {
|
|||||||
const endDate = new Date(week.week_end);
|
const endDate = new Date(week.week_end);
|
||||||
let workdays = 0;
|
let workdays = 0;
|
||||||
let filledWorkdays = 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)) {
|
for (let d = new Date(startDate); d <= endDate; d.setDate(d.getDate() + 1)) {
|
||||||
const day = d.getDay();
|
const day = d.getDay();
|
||||||
@@ -408,15 +409,18 @@ function registerUserRoutes(app) {
|
|||||||
// Tag gilt als ausgefüllt wenn:
|
// Tag gilt als ausgefüllt wenn:
|
||||||
// - Ganzer Tag Urlaub (vacation_type = 'full')
|
// - Ganzer Tag Urlaub (vacation_type = 'full')
|
||||||
// - Krank (sick_status = 1)
|
// - Krank (sick_status = 1)
|
||||||
|
// - Ganzer Tag Überstunden (overtime_taken_hours = fullDayHours)
|
||||||
// - ODER Start- und End-Zeit vorhanden sind
|
// - ODER Start- und End-Zeit vorhanden sind
|
||||||
if (entry) {
|
if (entry) {
|
||||||
const isFullDayVacation = entry.vacation_type === 'full';
|
const isFullDayVacation = entry.vacation_type === 'full';
|
||||||
const isSick = entry.sick_status === 1 || entry.sick_status === true;
|
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 &&
|
const hasStartAndEnd = entry.start_time && entry.end_time &&
|
||||||
entry.start_time.toString().trim() !== '' &&
|
entry.start_time.toString().trim() !== '' &&
|
||||||
entry.end_time.toString().trim() !== '';
|
entry.end_time.toString().trim() !== '';
|
||||||
|
|
||||||
if (isFullDayVacation || isSick || hasStartAndEnd) {
|
if (isFullDayVacation || isSick || isFullDayOvertime || hasStartAndEnd) {
|
||||||
filledWorkdays++;
|
filledWorkdays++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -462,7 +466,7 @@ function registerUserRoutes(app) {
|
|||||||
const isFullDayOvertime = overtimeValue > 0 && Math.abs(overtimeValue - fullDayHours) < 0.01;
|
const isFullDayOvertime = overtimeValue > 0 && Math.abs(overtimeValue - fullDayHours) < 0.01;
|
||||||
|
|
||||||
if (entry.overtime_taken_hours) {
|
if (entry.overtime_taken_hours) {
|
||||||
weekOvertimeTaken += entry.overtime_taken_hours;
|
weekOvertimeTaken += parseFloat(entry.overtime_taken_hours) || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wenn 8 Überstunden eingetragen sind, zählt der Tag als 0 Stunden
|
// Wenn 8 Überstunden eingetragen sind, zählt der Tag als 0 Stunden
|
||||||
@@ -666,6 +670,7 @@ function registerUserRoutes(app) {
|
|||||||
const endDate = new Date(week.week_end);
|
const endDate = new Date(week.week_end);
|
||||||
let workdays = 0;
|
let workdays = 0;
|
||||||
let filledWorkdays = 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)) {
|
for (let d = new Date(startDate); d <= endDate; d.setDate(d.getDate() + 1)) {
|
||||||
const day = d.getDay();
|
const day = d.getDay();
|
||||||
@@ -681,11 +686,13 @@ function registerUserRoutes(app) {
|
|||||||
if (entry) {
|
if (entry) {
|
||||||
const isFullDayVacation = entry.vacation_type === 'full';
|
const isFullDayVacation = entry.vacation_type === 'full';
|
||||||
const isSick = entry.sick_status === 1 || entry.sick_status === true;
|
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 &&
|
const hasStartAndEnd = entry.start_time && entry.end_time &&
|
||||||
entry.start_time.toString().trim() !== '' &&
|
entry.start_time.toString().trim() !== '' &&
|
||||||
entry.end_time.toString().trim() !== '';
|
entry.end_time.toString().trim() !== '';
|
||||||
|
|
||||||
if (isFullDayVacation || isSick || hasStartAndEnd) {
|
if (isFullDayVacation || isSick || isFullDayOvertime || hasStartAndEnd) {
|
||||||
filledWorkdays++;
|
filledWorkdays++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ function getCurrentOvertimeForUser(userId, db, callback) {
|
|||||||
const endDate = new Date(week.week_end);
|
const endDate = new Date(week.week_end);
|
||||||
let workdays = 0;
|
let workdays = 0;
|
||||||
let filledWorkdays = 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)) {
|
for (let d = new Date(startDate); d <= endDate; d.setDate(d.getDate() + 1)) {
|
||||||
const day = d.getDay();
|
const day = d.getDay();
|
||||||
@@ -108,12 +109,14 @@ function getCurrentOvertimeForUser(userId, db, callback) {
|
|||||||
if (entry) {
|
if (entry) {
|
||||||
const isFullDayVacation = entry.vacation_type === 'full';
|
const isFullDayVacation = entry.vacation_type === 'full';
|
||||||
const isSick = entry.sick_status === 1 || entry.sick_status === true;
|
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 =
|
const hasStartAndEnd =
|
||||||
entry.start_time &&
|
entry.start_time &&
|
||||||
entry.end_time &&
|
entry.end_time &&
|
||||||
entry.start_time.toString().trim() !== '' &&
|
entry.start_time.toString().trim() !== '' &&
|
||||||
entry.end_time.toString().trim() !== '';
|
entry.end_time.toString().trim() !== '';
|
||||||
if (isFullDayVacation || isSick || hasStartAndEnd) {
|
if (isFullDayVacation || isSick || isFullDayOvertime || hasStartAndEnd) {
|
||||||
filledWorkdays++;
|
filledWorkdays++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user