From a548e787ba8bd79d82104717f006202a7f0fc8be Mon Sep 17 00:00:00 2001 From: cmaddox5 Date: Mon, 9 Dec 2024 09:38:10 -0500 Subject: [PATCH] Only keep one list of closures. --- .../v2/elevator/elevator_closures_list.tsx | 12 +++++++----- .../v2/candidate_generator/elevator/closures.ex | 7 +++---- .../v2/widget_instance/elevator_closures_list.ex | 11 ++++------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/assets/src/components/v2/elevator/elevator_closures_list.tsx b/assets/src/components/v2/elevator/elevator_closures_list.tsx index 4a7d559ee..a845833ff 100644 --- a/assets/src/components/v2/elevator/elevator_closures_list.tsx +++ b/assets/src/components/v2/elevator/elevator_closures_list.tsx @@ -198,21 +198,23 @@ const OutsideClosureList = ({ interface Props extends WrappedComponentProps { id: string; - in_station_closures: Closure[]; - other_stations_with_closures: StationWithClosures[]; + stations_with_closures: StationWithClosures[]; station_id: string; } const ElevatorClosuresList = ({ - other_stations_with_closures: stations, - in_station_closures: inStationClosures, + stations_with_closures: stations, station_id: stationId, lastUpdate, onFinish, }: Props) => { return (
- + s.id === stationId) + .flatMap((s) => s.closures)} + /> Enum.group_by(&get_parent_station_id_from_informed_entities(&1.informed_entities)) |> Enum.map(fn {parent_station_id, alerts} -> diff --git a/lib/screens/v2/widget_instance/elevator_closures_list.ex b/lib/screens/v2/widget_instance/elevator_closures_list.ex index 536e31d9b..43143fc11 100644 --- a/lib/screens/v2/widget_instance/elevator_closures_list.ex +++ b/lib/screens/v2/widget_instance/elevator_closures_list.ex @@ -5,12 +5,11 @@ defmodule Screens.V2.WidgetInstance.ElevatorClosuresList do alias Screens.V2.WidgetInstance.Elevator.Closure alias ScreensConfig.V2.Elevator - defstruct ~w[app_params in_station_closures other_stations_with_closures station_id]a + defstruct ~w[app_params stations_with_closures station_id]a @type t :: %__MODULE__{ app_params: Elevator.t(), - in_station_closures: list(Closure.t()), - other_stations_with_closures: list(__MODULE__.Station.t()), + stations_with_closures: list(__MODULE__.Station.t()), station_id: String.t() } @@ -34,14 +33,12 @@ defmodule Screens.V2.WidgetInstance.ElevatorClosuresList do def serialize(%__MODULE__{ app_params: %Elevator{elevator_id: id}, - in_station_closures: in_station_closures, - other_stations_with_closures: other_stations_with_closures, + stations_with_closures: stations_with_closures, station_id: station_id }), do: %{ id: id, - in_station_closures: in_station_closures, - other_stations_with_closures: other_stations_with_closures, + stations_with_closures: stations_with_closures, station_id: station_id }