From eb64d43d6c2090dfae49abe8090047a40447a5c8 Mon Sep 17 00:00:00 2001 From: Cristen Jones Date: Tue, 21 May 2024 10:05:06 -0400 Subject: [PATCH] hotfix(TimetableController): don't sort ferry stops by route pattern (#2068) --- .../controllers/schedule/timetable_controller.ex | 12 ++++++++++++ lib/routes/route.ex | 1 - test/routes/route_test.exs | 3 +-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/dotcom_web/controllers/schedule/timetable_controller.ex b/lib/dotcom_web/controllers/schedule/timetable_controller.ex index 0e3ac9f70f..3719faa521 100644 --- a/lib/dotcom_web/controllers/schedule/timetable_controller.ex +++ b/lib/dotcom_web/controllers/schedule/timetable_controller.ex @@ -224,6 +224,18 @@ defmodule DotcomWeb.ScheduleController.TimetableController do }, required(:trip_stops) => [Stops.Stop.t()] } + def build_timetable(%Conn{assigns: %{route: %Route{id: route_id, type: 4}}} = conn, schedules) do + trip_schedules = Map.new(schedules, &trip_schedule(&1)) + + trip_stops = + @stops_repo.by_route(route_id, conn.assigns.direction_id) + + %{ + trip_schedules: trip_schedules, + trip_stops: trip_stops + } + end + def build_timetable(conn, schedules) do trip_schedules = Map.new(schedules, &trip_schedule(&1)) inbound? = conn.assigns.direction_id == 1 diff --git a/lib/routes/route.ex b/lib/routes/route.ex index f98c69e292..6340b1db83 100644 --- a/lib/routes/route.ex +++ b/lib/routes/route.ex @@ -238,7 +238,6 @@ defmodule Routes.Route do def hidden?(%{id: "9702"}), do: true def hidden?(%{id: "9703"}), do: true def hidden?(%{id: "Logan-" <> _}), do: true - def hidden?(%{id: "CapeFlyer"}), do: true def hidden?(%{id: "Boat-F3"}), do: true def hidden?(_), do: false diff --git a/test/routes/route_test.exs b/test/routes/route_test.exs index fabfa6fc8a..61407f116f 100644 --- a/test/routes/route_test.exs +++ b/test/routes/route_test.exs @@ -253,8 +253,7 @@ defmodule Routes.RouteTest do "9701", "9702", "9703", - "Logan-Airport", - "CapeFlyer" + "Logan-Airport" ] for route_id <- hidden_routes do