Adjust query order, remove console.logs

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2024-04-23 20:20:51 +01:00
parent 2ff822d8eb
commit 77ca61e178
1 changed files with 2 additions and 7 deletions

View File

@ -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"];