Skip to content

Commit

Permalink
hotfix(TimetableController): check for date in rating (#1913)
Browse files Browse the repository at this point in the history
skip fetching data for dates outside the rating
  • Loading branch information
thecristen authored Mar 11, 2024
1 parent 9834fad commit 2ed9b0d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/dotcom_web/controllers/schedule/timetable_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ defmodule DotcomWeb.ScheduleController.TimetableController do
Util.log_duration(__MODULE__, :assign_trip_schedules, [conn])
end

def assign_trip_schedules(%{assigns: %{route: route, direction_id: direction_id}} = conn) do
def assign_trip_schedules(
%{assigns: %{route: route, direction_id: direction_id, date_in_rating?: true}} = conn
) do
timetable_schedules = timetable_schedules(conn)
header_schedules = header_schedules(timetable_schedules)
vehicle_schedules = vehicle_schedules(conn, timetable_schedules)
Expand Down Expand Up @@ -83,6 +85,14 @@ defmodule DotcomWeb.ScheduleController.TimetableController do
|> assign(:all_stops, all_stops)
end

def assign_trip_schedules(conn) do
conn
|> assign(:timetable_schedules, [])
|> assign(:header_schedules, [])
|> assign(:vehicle_schedules, [])
|> assign(:prior_stops, %{})
end

@spec track_changes(
%{required({Schedules.Trip.id_t(), Stops.Stop.id_t()}) => Schedules.Schedule.t()},
MapSet.t(Stops.Stop.id_t())
Expand Down

0 comments on commit 2ed9b0d

Please sign in to comment.