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;
|
||||
});
|
||||
|
@ -35,9 +35,9 @@ const SchedulePage = () => {
|
||||
}, []); // Empty dependency array means this effect runs once on component mount
|
||||
|
||||
// temporary alert for the users
|
||||
useEffect(() => {
|
||||
alert("Мили братя, искаме само да ви напомним да ни изпратите вашите предпочитания за юни до 25-то число като използвате меню 'Възможности'. Ако имате проблем, моля пишете ни на 'specialnosvidetelstvanesofia@gmail.com'");
|
||||
}, []);
|
||||
// useEffect(() => {
|
||||
// alert("Мили братя, искаме само да ви напомним да ни изпратите вашите предпочитания за юни до 25-то число като използвате меню 'Възможности'. Ако имате проблем, моля пишете ни на 'specialnosvidetelstvanesofia@gmail.com'");
|
||||
// }, []);
|
||||
|
||||
|
||||
return (
|
||||
|
Reference in New Issue
Block a user