Skip to content

Commit

Permalink
feat: Create a data structure to populate the system status widget (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
joshlarson authored Feb 5, 2025
1 parent 995eb2f commit 25af2d0
Show file tree
Hide file tree
Showing 4 changed files with 990 additions and 10 deletions.
18 changes: 10 additions & 8 deletions lib/dotcom/system_status.ex
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
defmodule Dotcom.SystemStatus do
@moduledoc """
The system status feature is a widget that's intended to appear on the
homepage, as well as eventually several other places throughout the site.
The widget will show statuses for each of the subway lines (Red, Orange,
Green, Blue), which might look like "Normal Service", or information
about current or upcoming alerts.
This module is responsible for reporting data in a format that can easily
be plugged into a component on the frontend.
This module exists to provide a simple view into the status of the
subway system, for each line, showing whether its running normally,
or whether there are alerts that impact service.
"""

alias Dotcom.SystemStatus
Expand Down Expand Up @@ -36,4 +31,11 @@ defmodule Dotcom.SystemStatus do
|> SystemStatus.Alerts.for_day(datetime)
|> SystemStatus.Alerts.filter_relevant()
end

@doc """
Returns a map indicating the subway status for each of the subway lines.
"""
def subway_status() do
subway_alerts_for_today() |> SystemStatus.Subway.subway_status(Timex.now())
end
end
Loading

0 comments on commit 25af2d0

Please sign in to comment.