From 9f84399c0ab287dd87dfa24630a8db3af094bdc7 Mon Sep 17 00:00:00 2001 From: Aaron Claydon Date: Sun, 15 Dec 2024 22:04:24 +0000 Subject: [PATCH] fix journey planner query --- pkg/api/routes/planner.go | 2 ++ pkg/dataaggregator/source/journeyplanner/journeyplan.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/api/routes/planner.go b/pkg/api/routes/planner.go index 21ef145..f96f7ce 100644 --- a/pkg/api/routes/planner.go +++ b/pkg/api/routes/planner.go @@ -38,6 +38,7 @@ func getPlanBetweenStops(c *fiber.Ctx) error { if err != nil { c.SendStatus(fiber.StatusNotFound) return c.JSON(fiber.Map{ + "field": "origin", "error": err.Error(), }) } @@ -48,6 +49,7 @@ func getPlanBetweenStops(c *fiber.Ctx) error { if err != nil { c.SendStatus(fiber.StatusNotFound) return c.JSON(fiber.Map{ + "field": "destination", "error": err.Error(), }) } diff --git a/pkg/dataaggregator/source/journeyplanner/journeyplan.go b/pkg/dataaggregator/source/journeyplanner/journeyplan.go index 040ab67..1bd2eb5 100644 --- a/pkg/dataaggregator/source/journeyplanner/journeyplan.go +++ b/pkg/dataaggregator/source/journeyplanner/journeyplan.go @@ -23,7 +23,7 @@ func (s Source) JourneyPlanQuery(q query.JourneyPlan) (*ctdf.JourneyPlanResults, Stop: q.OriginStop, Count: q.Count * 10, StartDateTime: q.StartDateTime, - Filter: &bson.M{"path.destinationstopref": q.DestinationStop.PrimaryIdentifier}, + Filter: &bson.M{"path.destinationstopref": bson.M{"$in": append(q.DestinationStop.OtherIdentifiers, q.DestinationStop.PrimaryIdentifier)}}, }) if err != nil {