Skip to content

Commit

Permalink
Add stop headsign to repo condensed (#2396)
Browse files Browse the repository at this point in the history
* add stop headsign to repo condensed

* fixup add stop headsign to repo condensed

---------

Co-authored-by: Cristen Jones <[email protected]>
  • Loading branch information
anthonyshull and thecristen authored Feb 21, 2025
1 parent 2320fcb commit 22d1f87
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/schedules/repo_condensed.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ defmodule Schedules.RepoCondensed do
@default_params [
include: "trip,trip.occupancies",
"fields[schedule]":
"departure_time,arrival_time,drop_off_type,pickup_type,stop_sequence,timepoint",
"departure_time,arrival_time,drop_off_type,pickup_type,stop_sequence,stop_headsign,timepoint",
"fields[trip]": "name,headsign,direction_id,bikes_allowed"
]

Expand Down Expand Up @@ -56,13 +56,11 @@ defmodule Schedules.RepoCondensed do
end
end

defp has_trip?({_, trip_id, _, _, _, _, _, _, _, _, _}) when is_nil(trip_id) do
defp has_trip?({_, trip_id, _, _, _, _, _, _, _, _, _, _}) when is_nil(trip_id) do
false
end

defp has_trip?({_, _, _, _, _, _, _, _, _, _, _}) do
true
end
defp has_trip?(_), do: true

defp valid?(%JsonApi.Item{relationships: %{"trip" => [%JsonApi.Item{id: id} | _]}})
when not is_nil(id) do
Expand Down Expand Up @@ -119,7 +117,7 @@ defmodule Schedules.RepoCondensed do

defp build_structs(schedules) do
schedules
|> Enum.map(fn {_, trip_id, stop_id, _, _, time, _, _, _, stop_sequence, _} ->
|> Enum.map(fn {_, trip_id, stop_id, _, _, time, _, _, _, stop_sequence, _, _} ->
Task.async(fn ->
trip = Repo.trip(trip_id)
stop = @stops_repo.get!(stop_id)
Expand Down
2 changes: 2 additions & 0 deletions lib/schedules/schedule.ex
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ defmodule Schedules.ScheduleCondensed do
route_pattern_id: nil,
train_number: nil,
stop_sequence: 0,
stop_headsign: nil,
headsign: nil

@type t :: %Schedules.ScheduleCondensed{
Expand All @@ -63,6 +64,7 @@ defmodule Schedules.ScheduleCondensed do
route_pattern_id: String.t() | nil,
train_number: String.t() | nil,
stop_sequence: non_neg_integer,
stop_headsign: String.t() | nil,
headsign: String.t()
}
end
Expand Down

0 comments on commit 22d1f87

Please sign in to comment.