Skip to content

Commit

Permalink
chore: Show Fairmount Line stations on Franklin/Foxboro Line
Browse files Browse the repository at this point in the history
  • Loading branch information
jfabi committed May 15, 2024
1 parent eba31c8 commit 8f4f9d5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 30 deletions.
43 changes: 25 additions & 18 deletions apps/state/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,35 @@ config :state, :stops_on_route,
config :state, :stops_on_route,
stop_order_overrides: %{
{"CR-Franklin", 0} => [
["Norwood Central", "Windsor Gardens", "Plimptonville", "Walpole"],
[
"place-NEC-2203",
"place-DB-2265",
"place-DB-2258",
"place-DB-2249",
"place-DB-2240",
"place-DB-2230",
"place-DB-2222",
"place-DB-2205",
"place-DB-0095",
"place-FB-0109"
],
["place-FB-0148", "place-FB-0166", "place-FB-0177", "place-FB-0191"],
["Walpole", "Foxboro", "Norfolk"],
["place-FB-0191", "place-FS-0049", "place-FB-0230"]
],
{"CR-Franklin", 1} => [
["Norfolk", "Foxboro", "Walpole"],
["place-FB-0230", "place-FS-0049", "place-FB-0191"]
["place-FB-0230", "place-FS-0049", "place-FB-0191"],
[
"place-FB-0109",
"place-DB-0095",
"place-DB-2205",
"place-DB-2222",
"place-DB-2230",
"place-DB-2240",
"place-DB-2249",
"place-DB-2258",
"place-DB-2265",
"place-NEC-2203"
]
],
{"CR-Fairmount", 0} => [
["Readville", "Dedham Corp Center", "Foxboro"],
Expand Down Expand Up @@ -455,13 +476,6 @@ config :state, :stops_on_route,
config :state, :stops_on_route,
not_on_route: %{
{"CR-Franklin", 0} => [
"place-DB-2265",
"place-DB-2258",
"place-DB-2249",
"place-DB-2240",
"place-DB-2230",
"place-DB-2222",
"place-DB-2205",
"place-NEC-2173",
"place-NEC-2139",
"place-NEC-2108",
Expand All @@ -473,13 +487,6 @@ config :state, :stops_on_route,
"place-NEC-1659"
],
{"CR-Franklin", 1} => [
"place-DB-2265",
"place-DB-2258",
"place-DB-2249",
"place-DB-2240",
"place-DB-2230",
"place-DB-2222",
"place-DB-2205",
"place-NEC-2173",
"place-NEC-2139",
"place-NEC-2108",
Expand Down
32 changes: 20 additions & 12 deletions apps/state/test/state/stops_on_route_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,10 @@ defmodule State.StopsOnRouteTest do
test "shows Plimptonville after Windsor Gardens even when they don't share a trip" do
State.Stop.new_state([
%Model.Stop{id: "place-sstat"},
%Model.Stop{id: "Windsor Gardens"},
%Model.Stop{id: "Plimptonville"},
%Model.Stop{id: "Walpole"},
%Model.Stop{id: "Franklin"}
%Model.Stop{id: "place-FB-0166"},
%Model.Stop{id: "place-FB-0177"},
%Model.Stop{id: "place-FB-0191"},
%Model.Stop{id: "place-FB-0275"}
])

State.Route.new_state([%Model.Route{id: "CR-Franklin"}])
Expand All @@ -310,28 +310,36 @@ defmodule State.StopsOnRouteTest do

State.Schedule.new_state([
%Model.Schedule{trip_id: "via-plimptonville", stop_id: "place-sstat", stop_sequence: 1},
%Model.Schedule{trip_id: "via-plimptonville", stop_id: "Plimptonville", stop_sequence: 2},
%Model.Schedule{trip_id: "via-plimptonville", stop_id: "Franklin", stop_sequence: 3},
%Model.Schedule{trip_id: "via-plimptonville", stop_id: "place-FB-0177", stop_sequence: 2},
%Model.Schedule{trip_id: "via-plimptonville", stop_id: "place-FB-0275", stop_sequence: 3},
# Windsor Gardens trip has more stops because this bug only shows up when the merge
# has windor gardens on the left and plimptonville on the right.
# They're sorted by length before merging, so this forces them to be in the order to make the bug appear.
%Model.Schedule{trip_id: "via-windsor-gardens", stop_id: "place-sstat", stop_sequence: 1},
%Model.Schedule{
trip_id: "via-windsor-gardens",
stop_id: "Windsor Gardens",
stop_id: "place-FB-0166",
stop_sequence: 2
},
%Model.Schedule{trip_id: "via-windsor-gardens", stop_id: "Walpole", stop_sequence: 3},
%Model.Schedule{trip_id: "via-windsor-gardens", stop_id: "Franklin", stop_sequence: 4}
%Model.Schedule{
trip_id: "via-windsor-gardens",
stop_id: "place-FB-0191",
stop_sequence: 3
},
%Model.Schedule{
trip_id: "via-windsor-gardens",
stop_id: "place-FB-0275",
stop_sequence: 4
}
])

update!()

stop_ids = by_route_id("CR-Franklin")

assert Enum.filter(stop_ids, &(&1 in ["Windsor Gardens", "Plimptonville"])) == [
"Windsor Gardens",
"Plimptonville"
assert Enum.filter(stop_ids, &(&1 in ["place-FB-0166", "place-FB-0177"])) == [
"place-FB-0166",
"place-FB-0177"
]
end

Expand Down

0 comments on commit 8f4f9d5

Please sign in to comment.