From e2cba379383da04775a8efad895b2b8cc0cc6a61 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Wed, 31 May 2023 20:40:34 +0100 Subject: [PATCH] Add notes to findByHeadcode(headcode) Signed-off-by: Fred Boniface --- src/services/trainService.services.js | 2 ++ 1 file changed, 2 insertions(+) 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); }