diff --git a/src/services/trainService.services.js b/src/services/trainService.services.js index 0520809..ddd55e9 100644 --- a/src/services/trainService.services.js +++ b/src/services/trainService.services.js @@ -14,6 +14,8 @@ async function findByHeadcode(headcode) { scheduleEndDate: {$gte: now}, daysRun: {$in: [shortDay]} }; + // At this point, the returned objects need sorting to ensure the correct object is returned. + // C, N, O, P is the order - C being the preferred, then N, then O and finally P. return db.query('timetable', query); }