data.filterPublishers can filter by ID,
api/getPublisherInfo uses dataHelper.filterPubs instead of api.filterPublishers because it handles repeating avs and calcs statistics: shiftgenerate has fn to rank pubs based on weights. stop message every page load; other fixes
This commit is contained in:
@ -362,7 +362,6 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
|
||||
const newAssignment = {
|
||||
publisher: { connect: { id: publisher.id } },
|
||||
shift: { connect: { id: shiftId } },
|
||||
isActive: true,
|
||||
isConfirmed: true
|
||||
};
|
||||
const { data } = await axiosInstance.post("/api/data/assignments", newAssignment);
|
||||
@ -842,7 +841,7 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
|
||||
return common.getStartOfWeek(value) <= shiftDate && shiftDate <= common.getEndOfWeek(value);
|
||||
});
|
||||
const dayShifts = weekShifts.map(shift => {
|
||||
const isAvailable = publisher.availabilities.some(avail =>
|
||||
const isAvailable = publisher.availabilities?.some(avail =>
|
||||
avail.startTime <= shift.startTime && avail.endTime >= shift.endTime
|
||||
);
|
||||
let color = isAvailable ? getColorForShift(shift) : 'bg-gray-300';
|
||||
@ -863,7 +862,7 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
|
||||
|
||||
const hasAssignment = (shiftId) => {
|
||||
// return publisher.assignments.some(ass => ass.shift.id == shiftId);
|
||||
return publisher.assignments.some(ass => {
|
||||
return publisher.assignments?.some(ass => {
|
||||
console.log(`Comparing: ${ass.shift.id} to ${shiftId}: ${ass.shift.id === shiftId}`);
|
||||
return ass.shift.id === shiftId;
|
||||
});
|
||||
|
Reference in New Issue
Block a user