correctly assume if assignmen is old, new database fields suggestions

This commit is contained in:
Dobromir Popov
2024-02-28 23:22:10 +02:00
parent 4d4f912644
commit 7ebf442adc
3 changed files with 23 additions and 11 deletions

View File

@ -735,7 +735,11 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
console.log("dayShifts:", dayShifts);
const hasAssignment = (shiftId) => {
return publisher.assignments.some(ass => ass.shift.id === shiftId);
// return publisher.assignments.some(ass => ass.shift.id == shiftId);
return publisher.assignments.some(ass => {
console.log(`Comparing: ${ass.shift.id} to ${shiftId}: ${ass.shift.id === shiftId}`);
return ass.shift.id === shiftId;
});
};
@ -780,9 +784,9 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
return (
<div
key={index}
className={`text-sm text-white p-2 rounded-md ${isFromPrevMonth ? 'border-l-4 border-yellow-500' : ''} ${assignmentExists ? 'bg-blue-200' : shift.color} h-24 flex flex-col justify-center`}
className={`text-sm text-white p-2 rounded-md ${isFromPrevMonth ? 'border-l-6 border-black-500' : ''} ${assignmentExists ? 'bg-blue-200' : shift.color} h-24 flex flex-col justify-center`}
>
{common.getTimeRange(shift.startTime, shift.endTime)}
{common.getTimeRange(shift.startTime, shift.endTime)} {shift.id}
{!assignmentExists && shift.isAvailable && (
<button onClick={() => { addAssignment(publisher, shift.id); onClose() }}