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