From 77ca61e178e6d2af3f54341fed489d1c49367882 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Tue, 23 Apr 2024 20:20:51 +0100 Subject: [PATCH] Adjust query order, remove console.logs Signed-off-by: Fred Boniface --- src/services/trainService.services.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/services/trainService.services.ts b/src/services/trainService.services.ts index 46d2e2e..d0c1ffc 100644 --- a/src/services/trainService.services.ts +++ b/src/services/trainService.services.ts @@ -34,11 +34,10 @@ export async function findByHeadcode( const query = { headcode: sanitizedHeadcode.toUpperCase(), + daysRun: { $in: [shortDay] }, scheduleStartDate: { $lte: searchDate }, scheduleEndDate: { $gte: searchDate }, - daysRun: { $in: [shortDay] }, }; - console.log(JSON.stringify(query)) const pipeline = getFindByHeadcodePipeline(query); const result: SimpleService[] = (await queryAggregate( @@ -68,11 +67,10 @@ export async function findByTrainUid( // Build query const query = { trainUid: uid.toUpperCase(), + daysRun: { $in: [getShortDay(queryDate)] }, scheduleStartDate: { $lte: queryDate }, scheduleEndDate: { $gte: queryDate }, - daysRun: { $in: [getShortDay(queryDate)] }, }; - logger.debug(query) const pipeline = getFindByTrainUidPipeline(query); const result = (await queryAggregate("timetable", pipeline)) as Service[]; @@ -86,7 +84,6 @@ export async function findByTrainUid( } else { pis = null; } - console.log(JSON.stringify(services[0])) return formatTimetableDetail(services[0], pis); } @@ -139,8 +136,6 @@ function filterServices(services: SimpleService[]): SimpleService[] { > = {}; let filteredServices: SimpleService[] = []; - console.log(services) - for (const service of services) { const trainUid = service["trainUid"], stpIndicator = service["stpIndicator"];