Skip to content

Commit

Permalink
fix(Stops.RouteStop): remove Fairmount/Foxboro logic (#1857)
Browse files Browse the repository at this point in the history
* tests: add both directions to schedule line page smoke tests

and add the failing route (Fairmount direction 1)

* fix(Stops.RouteStop): remove Fairmount/Foxboro logic
  • Loading branch information
thecristen authored Jan 18, 2024
1 parent 25e9107 commit c81add9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 35 deletions.
5 changes: 4 additions & 1 deletion cypress/e2e/smoke.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe("passes smoke test", () => {
const schedule_sections = [
["Boat-F1", "timetable"],
["CR-Worcester", "timetable"],
["CR-Worcester", "line"],
["CR-Fairmount", "line"],
["Green", "line"],
["Green-E", "line"],
["Red", "line"],
Expand All @@ -132,6 +132,9 @@ describe("passes smoke test", () => {
cy.visit(`/schedules/${route}/${tab}`);
if (tab == "line") {
cy.get(".m-schedule-diagram");
// test both directions
cy.contains("Change Direction").click();
cy.url().should("contain", "schedule_direction%5Bdirection_id%5D=1");
} else {
cy.get(".m-timetable");
}
Expand Down
34 changes: 0 additions & 34 deletions lib/stops/route_stop.ex
Original file line number Diff line number Diff line change
Expand Up @@ -191,40 +191,6 @@ defmodule Stops.RouteStop do
do_list_from_shapes(shape.name, Enum.map(stops, & &1.id), stops, route)
end

def list_from_shapes(shapes, stops, %Route{id: "CR-Fairmount"} = route, 0) do
mainline = Enum.find(shapes, &(&1.name == "South Station - Readville via Fairmount"))
foxboro_extension = Enum.find(shapes, &(&1.name == "South Station - Foxboro via Fairmount"))

distinct_stop_ids =
if foxboro_extension do
mainline.stop_ids |> Enum.concat(foxboro_extension.stop_ids) |> Enum.uniq()
else
mainline.stop_ids
end

[do_list_from_shapes(mainline.name, distinct_stop_ids, stops, route)]
|> merge_branch_list(0)
end

def list_from_shapes(shapes, stops, %Route{id: "CR-Fairmount"} = route, 1) do
mainline = Enum.find(shapes, &(&1.name == "Readville - South Station via Fairmount"))

foxboro_extension =
Enum.find(shapes, &(&1.name == "Forge Park/495 - South Station via Fairmount"))

distinct_stop_ids =
if foxboro_extension do
["place-FS-0049" | foxboro_extension.stop_ids]
|> Enum.concat(mainline.stop_ids)
|> Enum.uniq()
else
mainline.stop_ids
end

[do_list_from_shapes(foxboro_extension.name, distinct_stop_ids, stops, route)]
|> merge_branch_list(1)
end

def list_from_shapes(shapes, stops, route, direction_id) do
shapes
|> Enum.map(&do_list_from_shapes(&1.name, &1.stop_ids, stops, route))
Expand Down

0 comments on commit c81add9

Please sign in to comment.