don't show unpublished assignments in people's calendars

This commit is contained in:
Dobromir Popov
2024-04-24 13:22:38 +03:00
parent ef27309b27
commit 822b22b995

View File

@ -551,7 +551,8 @@ export async function filterPublishers(selectFields, searchText, filterDate, fet
select: { select: {
id: true, id: true,
startTime: true, startTime: true,
endTime: true endTime: true,
isPublished: true
} }
} }
}, },
@ -854,7 +855,11 @@ async function getCalendarEvents(publisherId, date, availabilities = true, assig
}); });
} }
if (assignments) { if (assignments) {
publisher.assignments?.forEach(item => { //only published shifts
publisher.assignments?.filter(
assignment => assignment.shift.isPublished
).forEach(item => {
result.push({ result.push({
...item, ...item,
title: common.getTimeFomatted(new Date(item.shift.startTime)) + "-" + common.getTimeFomatted(new Date(item.shift.endTime)), title: common.getTimeFomatted(new Date(item.shift.startTime)) + "-" + common.getTimeFomatted(new Date(item.shift.endTime)),