schedule - skip empty shifts
This commit is contained in:
@ -95,6 +95,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
lt: toDate,
|
||||
},
|
||||
},
|
||||
orderBy: {
|
||||
startTime: 'asc',
|
||||
},
|
||||
include: {
|
||||
assignments: {
|
||||
where: {},
|
||||
@ -147,7 +150,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
.join(", "),
|
||||
};
|
||||
|
||||
groupedShifts[day][time].push(shiftSchedule);
|
||||
if (shiftSchedule.names.length > 0) {
|
||||
groupedShifts[day][time].push(shiftSchedule);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err + " " + JSON.stringify(shifts[i]));
|
||||
@ -188,8 +193,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
|
||||
dayEvent.shifts.push(...groupedShifts[day][time]);
|
||||
}
|
||||
|
||||
monthlySchedule.events.push(dayEvent);
|
||||
if (dayEvent) {
|
||||
monthlySchedule.events.push(dayEvent);
|
||||
}
|
||||
}
|
||||
|
||||
const outputPath = path.join(process.cwd(), 'public', 'content', 'output');
|
||||
|
Reference in New Issue
Block a user