From c81add9048170e6c629f95f4c20f4ca77a71fa2b Mon Sep 17 00:00:00 2001 From: Cristen Jones Date: Thu, 18 Jan 2024 13:51:01 -0500 Subject: [PATCH] fix(Stops.RouteStop): remove Fairmount/Foxboro logic (#1857) * 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 --- cypress/e2e/smoke.cy.js | 5 ++++- lib/stops/route_stop.ex | 34 ---------------------------------- 2 files changed, 4 insertions(+), 35 deletions(-) diff --git a/cypress/e2e/smoke.cy.js b/cypress/e2e/smoke.cy.js index 83a2cf2cc3..bcb6e4108d 100644 --- a/cypress/e2e/smoke.cy.js +++ b/cypress/e2e/smoke.cy.js @@ -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"], @@ -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"); } diff --git a/lib/stops/route_stop.ex b/lib/stops/route_stop.ex index 719ff49960..50b40bc675 100644 --- a/lib/stops/route_stop.ex +++ b/lib/stops/route_stop.ex @@ -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))