Skip to content

Commit

Permalink
chore(TimetableController): log sorted stop list (#2016)
Browse files Browse the repository at this point in the history
  • Loading branch information
thecristen authored Apr 29, 2024
1 parent f571d2f commit 80406ed
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/dotcom_web/controllers/schedule/timetable_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,28 @@ defmodule DotcomWeb.ScheduleController.TimetableController do

track_changes = track_changes(trip_schedules, canonical_stop_ids)

## Logging to capture misordered stops on CR-Newburyport timetable ##
# First, is this code even present?
Logger.info("dotcom_web.schedule_controller.timetable_controller.assign_trip_schedules")

if route.id == "CR-Newburyport" && direction_id == 1 do
[last, next | _rest] = Enum.map(all_stops, & &1.name) |> Enum.reverse()

case {last, next} do
{"North Station", "Chelsea"} ->
# Log both good and bad results so we can quantify
Logger.info(
"dotcom_web.schedule_controller.timetable_controller.assign_trip_schedules stop_order=expected"
)

_ ->
# Show the offending last two stops
Logger.warning(
"dotcom_web.schedule_controller.timetable_controller.assign_trip_schedules stop_order=unexpected last=#{last} next=#{next}"
)
end
end

conn
|> assign(:timetable_schedules, timetable_schedules)
|> assign(:header_schedules, header_schedules)
Expand Down

0 comments on commit 80406ed

Please sign in to comment.