updated every file for database changes; starting scheduling debugging

This commit is contained in:
2025-10-21 00:51:39 +02:00
parent 3127692d29
commit c023501f57

View File

@@ -97,17 +97,16 @@ export class SchedulingService {
const currentDate = new Date(startDate);
currentDate.setDate(startDate.getDate() + dayOffset);
const dayOfWeek = currentDate.getDay() === 0 ? 7 : currentDate.getDay();
const dayOfWeek = currentDate.getDay() === 0 ? 7 : currentDate.getDay(); // Convert Sunday from 0 to 7
const dayShifts = shiftPlan.shifts.filter(shift => shift.dayOfWeek === dayOfWeek);
dayShifts.forEach(shift => {
// ✅ CRITICAL FIX: Use consistent shift ID format that matches availability lookup
const shiftId = `shift_${dayOfWeek}_${shift.timeSlotId}`;
const dateStr = currentDate.toISOString().split('T')[0];
// ✅ Use day-of-week pattern instead of date-based pattern
const shiftId = `${shift.id}`;
shifts.push({
id: shiftId, // This will match what availabilities are looking for
date: dateStr,
id: shiftId, // This matches what frontend expects
date: currentDate.toISOString().split('T')[0],
timeSlotId: shift.timeSlotId,
requiredEmployees: shift.requiredEmployees,
minWorkers: 1,
@@ -115,7 +114,7 @@ export class SchedulingService {
isPriority: false
});
console.log(`✅ Generated shift: ${shiftId} for date ${dateStr}, day ${dayOfWeek}, timeSlot ${shift.timeSlotId}`);
console.log(`✅ Generated shift: ${shiftId} for day ${dayOfWeek}, timeSlot ${shift.timeSlotId}`);
});
}