mirror of
https://github.com/donpat1to/Schichtenplaner.git
synced 2025-12-01 06:55:45 +01:00
updated every file for database changes; starting scheduling debugging
This commit is contained in:
@@ -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}`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user