Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log: one debug log to get potential_interlining_blocks_by_date #2913

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions lib/realtime/vehicles.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defmodule Realtime.Vehicles do
@moduledoc false
require Logger

alias Realtime.{Ghost, Vehicle, VehicleOrGhost}
alias Schedule.{Block, Route, Trip}
Expand Down Expand Up @@ -38,7 +39,7 @@ defmodule Realtime.Vehicles do

@doc """
Exposed for testing.
Returns a map of vehicles & ghosts by route_id, omitting those without a route_id.
Returns a map of vehicles & ghosts by route_id, omitting those without a route_id. # is this omission a problem?
"""
@spec group_by_route_with_blocks(
[Vehicle.t()],
Expand All @@ -57,6 +58,11 @@ defmodule Realtime.Vehicles do
now,
timepoint_names_by_id
) do

Logger.debug(fn ->
"in group_by_route_with_blocks, potential_interlining_blocks_by_date=#{potential_interlining_blocks_by_date}"
end)

ghosts = Ghost.ghosts(active_runs_by_date, ungrouped_vehicles, now, timepoint_names_by_id)
vehicles_and_ghosts = ghosts ++ ungrouped_vehicles

Expand All @@ -69,7 +75,7 @@ defmodule Realtime.Vehicles do
{pulling_out, not_pulling_out} =
Enum.split_with(on_route, &(&1.route_status == :pulling_out))

date_by_block_id =
date_by_block_id = # this is missing Lynn blocks?
potential_interlining_blocks_by_date
|> Enum.flat_map(fn {date, blocks} ->
Enum.map(blocks, &{&1.id, date})
Expand Down Expand Up @@ -112,7 +118,7 @@ defmodule Realtime.Vehicles do
trip.block_id == vehicle_or_ghost.block_id && trip.route_id == route_id
end)

block_date = Map.fetch!(date_by_block_id, incoming_trip.block_id)
block_date = Map.fetch!(date_by_block_id, incoming_trip.block_id) # ERROR: Incoming block_id "L442-125" not found in the map

incoming_trip_start_timestamp =
Util.Time.timestamp_for_time_of_day(incoming_trip.start_time, block_date)
Expand Down
Loading