Fix bug where cancelled service is not processed and sent to client due to no stops arrray being present.

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2024-04-16 21:31:09 +01:00
parent f4b5e9ce37
commit 1f0a39adc6
2 changed files with 9 additions and 0 deletions

View File

@ -38,6 +38,7 @@ export async function findByHeadcode(
scheduleEndDate: { $gte: searchDate },
daysRun: { $in: [shortDay] },
};
console.log(JSON.stringify(query))
const pipeline = getFindByHeadcodePipeline(query);
const result: SimpleService[] = (await queryAggregate(

View File

@ -36,6 +36,14 @@ export function formatTimetableDetail(
}
function formatStops(stops: Stop[]): OB_TrainTT_stopDetail[] {
if (!stops) {
return []
}
if (!stops.length) {
return []
}
// Cleanly coerce Stop[] to OB_TrainTT_stopDetail[]
const formattedStops: OB_TrainTT_stopDetail[] = [];