Adjust query order, remove console.logs
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
parent
2ff822d8eb
commit
77ca61e178
@ -34,11 +34,10 @@ export async function findByHeadcode(
|
|||||||
|
|
||||||
const query = {
|
const query = {
|
||||||
headcode: sanitizedHeadcode.toUpperCase(),
|
headcode: sanitizedHeadcode.toUpperCase(),
|
||||||
|
daysRun: { $in: [shortDay] },
|
||||||
scheduleStartDate: { $lte: searchDate },
|
scheduleStartDate: { $lte: searchDate },
|
||||||
scheduleEndDate: { $gte: searchDate },
|
scheduleEndDate: { $gte: searchDate },
|
||||||
daysRun: { $in: [shortDay] },
|
|
||||||
};
|
};
|
||||||
console.log(JSON.stringify(query))
|
|
||||||
const pipeline = getFindByHeadcodePipeline(query);
|
const pipeline = getFindByHeadcodePipeline(query);
|
||||||
|
|
||||||
const result: SimpleService[] = (await queryAggregate(
|
const result: SimpleService[] = (await queryAggregate(
|
||||||
@ -68,11 +67,10 @@ export async function findByTrainUid(
|
|||||||
// Build query
|
// Build query
|
||||||
const query = {
|
const query = {
|
||||||
trainUid: uid.toUpperCase(),
|
trainUid: uid.toUpperCase(),
|
||||||
|
daysRun: { $in: [getShortDay(queryDate)] },
|
||||||
scheduleStartDate: { $lte: queryDate },
|
scheduleStartDate: { $lte: queryDate },
|
||||||
scheduleEndDate: { $gte: queryDate },
|
scheduleEndDate: { $gte: queryDate },
|
||||||
daysRun: { $in: [getShortDay(queryDate)] },
|
|
||||||
};
|
};
|
||||||
logger.debug(query)
|
|
||||||
const pipeline = getFindByTrainUidPipeline(query);
|
const pipeline = getFindByTrainUidPipeline(query);
|
||||||
|
|
||||||
const result = (await queryAggregate("timetable", pipeline)) as Service[];
|
const result = (await queryAggregate("timetable", pipeline)) as Service[];
|
||||||
@ -86,7 +84,6 @@ export async function findByTrainUid(
|
|||||||
} else {
|
} else {
|
||||||
pis = null;
|
pis = null;
|
||||||
}
|
}
|
||||||
console.log(JSON.stringify(services[0]))
|
|
||||||
return formatTimetableDetail(services[0], pis);
|
return formatTimetableDetail(services[0], pis);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,8 +136,6 @@ function filterServices(services: SimpleService[]): SimpleService[] {
|
|||||||
> = {};
|
> = {};
|
||||||
let filteredServices: SimpleService[] = [];
|
let filteredServices: SimpleService[] = [];
|
||||||
|
|
||||||
console.log(services)
|
|
||||||
|
|
||||||
for (const service of services) {
|
for (const service of services) {
|
||||||
const trainUid = service["trainUid"],
|
const trainUid = service["trainUid"],
|
||||||
stpIndicator = service["stpIndicator"];
|
stpIndicator = service["stpIndicator"];
|
||||||
|
Loading…
Reference in New Issue
Block a user