Merge commit 'acc5983c5f1ff8da73a9d756d39565103ea1b962'

This commit is contained in:
Dobromir Popov
2024-03-06 10:01:28 +02:00

View File

@ -95,6 +95,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
lt: toDate, lt: toDate,
}, },
}, },
orderBy: {
startTime: 'asc',
},
include: { include: {
assignments: { assignments: {
where: {}, where: {},
@ -147,7 +150,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
.join(", "), .join(", "),
}; };
groupedShifts[day][time].push(shiftSchedule); if (shiftSchedule.names.length > 0) {
groupedShifts[day][time].push(shiftSchedule);
}
} }
} catch (err) { } catch (err) {
console.log(err + " " + JSON.stringify(shifts[i])); 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]); dayEvent.shifts.push(...groupedShifts[day][time]);
} }
if (dayEvent) {
monthlySchedule.events.push(dayEvent); monthlySchedule.events.push(dayEvent);
}
} }
const outputPath = path.join(process.cwd(), 'public', 'content', 'output'); const outputPath = path.join(process.cwd(), 'public', 'content', 'output');