fix missing shifts in myshifts;
fix serialization error
This commit is contained in:
@ -168,10 +168,12 @@ export const getServerSideProps = async (context) => {
|
||||
}
|
||||
|
||||
const prisma = common.getPrismaClient();
|
||||
const monthInfo = common.getMonthInfo(new Date());
|
||||
//minus 1 day from the firstMonday to get the last Sunday
|
||||
const lastSunday = new Date(monthInfo.firstMonday);
|
||||
lastSunday.setDate(lastSunday.getDate() - 1);
|
||||
let today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
// const monthInfo = common.getMonthInfo(today);
|
||||
// //minus 1 day from the firstMonday to get the last Sunday
|
||||
// const lastSunday = new Date(monthInfo.firstMonday);
|
||||
// lastSunday.setDate(lastSunday.getDate() - 1);
|
||||
const publisher = await prisma.publisher.findUnique({
|
||||
where: {
|
||||
id: session.user.id,
|
||||
@ -179,7 +181,7 @@ export const getServerSideProps = async (context) => {
|
||||
some: {
|
||||
shift: {
|
||||
startTime: {
|
||||
gte: lastSunday,
|
||||
gte: today,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -208,7 +210,7 @@ export const getServerSideProps = async (context) => {
|
||||
},
|
||||
});
|
||||
|
||||
const assignments = publisher?.assignments.filter(a => a.shift.startTime >= lastSunday && a.shift.isPublished) || [];
|
||||
const assignments = publisher?.assignments.filter(a => a.shift.startTime >= today && a.shift.isPublished) || [];
|
||||
|
||||
|
||||
const transformedAssignments = assignments?.sort((a, b) => a.shift.startTime - b.shift.startTime)
|
||||
|
Reference in New Issue
Block a user