updated every file for database changes; starting scheduling debugging

This commit is contained in:
2025-10-21 00:51:23 +02:00
parent 3c4fbc0798
commit 3127692d29
27 changed files with 1861 additions and 866 deletions

View File

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