Skip to content

Conversation

@joshlarson
Copy link
Contributor

Before

Screenshot 2025-09-26 at 1 37 45 PM

After

Screenshot 2025-09-26 at 1 36 33 PM

The fix is deceptively simple, and also a bit inelegant. We already have Dotcom.SystemStatus.CommuterRail.commuter_rail_route_status/1, which figures out the correct delay/cancellation count, so we can just use the data from that to populate commuter_rail_status/0 as well.

The inelegance comes from the fact that the <.alerts_commuter_rail_status /> frontend component relies on the data structure returned from commuter_rail_status/0 being structured a particular way, which is different from how commuter_rail_route_status/1 does it. So I added a bit of "adapter" logic to route_info/1 to convert the data structure commuter_rail_route_status/1 presents to the data structure `<.alerts_commuter_rail_status /> expects.

(This is especially inelegant because commuter_rail_route_status/1 already makes a distinction between train impacts (delays and cancellations) and service impacts (everything else), and <.alerts_commuter_rail_status /> does care about that distinction, but has to re-figure it out on its own, because commuter_rail_status/0 treats them all the same.)

Medium/longer-term, I think the thing to do is to update <.alerts_commuter_rail_status /> to accept commuter_rail_route_status/1-shaped data. I'm actively working on that now, and can add that to this PR. But this fixes a rider-facing bug, so I figured I'd share this commit as a standalone fix. We can decide whether we want to merge as-is and treat a more elegant approach as a follow-up, versus combining it all together and holding this PR until the refactor is done.

Asana Ticket: Fix how we count cancellations/delays on CR system status

@joshlarson joshlarson requested a review from a team as a code owner September 26, 2025 17:49
Copy link
Collaborator

@thecristen thecristen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems pretty reasonable~

Comment on lines 306 to 312
|> Map.new(fn {effect, impact_list} ->
{effect, impact_summary(impact_list)}
end)
|> Enum.into(%{
cancellation: impact_summary(cancellations),
delay: impact_summary(delays)
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should use Enum.into/3, like (untested)

|> Enum.into(%{
  cancellation: impact_summary(cancellations),
  delay: impact_summary(delays)
}, fn {effect, impact_list} ->
  {effect, impact_summary(impact_list)}
end)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooooh I almost wonder if it would be cleaner to swap the order of impact_summary, filtering, and adding in delays+cancellations to reduce more duplication... something like (also untested):

|> Enum.into(%{
  delay: delays,
  cancellation: cancellations,
})
|> Enum.reject(fn {_effect, impact_list} -> Enum.empty?(impact_list) end)
|> Map.new(fn {effect, impact_list} -> {effect, impact_summary(impact_list)} end)

@joshlarson joshlarson merged commit d5a4a37 into main Oct 3, 2025
18 checks passed
@joshlarson joshlarson deleted the jdl/fix/cr-delay-and-cancellation-counting branch October 3, 2025 19:05
thecristen added a commit that referenced this pull request Oct 14, 2025
* fix: Don't pattern-match on the string `"Now"` (#2733)

* fix: Show Orange Line headways in Schedule Finder (#2734)

* cleanup: Remove redundant Green Line schedule accordion (#2735)

* chore: Replace commuter-rail alerts page with a LiveView (#2732)

* fix: Remove trip planner from `robots.txt` to allow search engines to crawl it (#2738)

* fix: Images in embedded alerts with no descriptions (#2736)

* fix: Don't double-wrap alerts-page LiveViews in `container` elements (#2739)

* cleanup: Remove old `MTicket` plug (#2740)

* fix(cms): handle case where _format=json is not the last item

The previous documentation indicated that `_format=json` would always be
the final item in the query string. This is not always the case, so our
replacement strategy needs to handle it appearing anywhere.

We do this with a regular expression which can get find the string in
any location, and replace it with either an empty string (if it's at
the beginning or end) or a single `&` if it's in the middle

Test cases are also updated to handle all three positions.

* [Translate] system status (#2730)

* fix: Use the correct URL for the commuter rail LiveView and add tests (#2737)

* feat(Components): CR survey banner (#2743)

* feat(Components): CR survey banner

* add the survey banner to commuter rail pages

* fix(TripPlan.Loops): refine interline logic (#2746)

to be considered a loop for merging legs, legs must be on the same route.

* Monthly upgrade (#2742)

* build(deps): bump actions/upload-pages-artifact from 3 to 4 (#2709)

Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-pages-artifact/releases)
- [Commits](actions/upload-pages-artifact@v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-pages-artifact
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump axios from 1.8.2 to 1.12.2 (#2747)

Bumps [axios](https://github.com/axios/axios) from 1.8.2 to 1.12.2.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](axios/axios@v1.8.2...v1.12.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-version: 1.12.2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Localization for the datepicker in dotcom (#2749)

* localization test

* extract

* fix: Alert counts for multi-trip alerts in commuter rail status (#2744)

* fix: Don't crash the planned disruptions page if an alert is recurring and "until further notice" (#2751)

* Update base.csv (#2752)

Adding in "The RIDE" to list of terms to not translate.

* chore(deps): bump tmp and artillery (#2745)

Removes [tmp](https://github.com/raszi/node-tmp). It's no longer used after updating ancestor dependency [artillery](https://github.com/artilleryio/artillery). These dependencies need to be updated together.


Removes `tmp`

Updates `artillery` from 2.0.22 to 2.0.26
- [Release notes](https://github.com/artilleryio/artillery/releases)
- [Commits](artilleryio/artillery@artillery-2.0.22...artillery-2.0.26)

---
updated-dependencies:
- dependency-name: tmp
  dependency-version: 
  dependency-type: indirect
- dependency-name: artillery
  dependency-version: 2.0.26
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump aws-actions/configure-aws-credentials from 4 to 5 (#2748)

Bumps [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) from 4 to 5.
- [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases)
- [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md)
- [Commits](aws-actions/configure-aws-credentials@v4...v5)

---
updated-dependencies:
- dependency-name: aws-actions/configure-aws-credentials
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat(SearchHits): formatted search hits

* Improve search hit text and icon formatting
- Add file name text wrap
- Prevent icons from shrinking thanks to flexbox

* fix(TimetableLoader): distinguish error vs empty (#2755)

* feedback(SearchHits): more times

* chore: delete more things

* chore: delete known unused templates + styles (#2756)

* fix: contain input in narrow screen width

* feat: add bus stop id

* fix: restore tailwind for the JS-based dropdown

* feat: Live-update subway status on subway alerts page (#2675)

* feat: Live-update subway status on subway alerts page

* Update gettext reference line numbers

* fix: Dialyzer errors

* cleanup: Call system status directly on init

* cleanup: Abstract `SubwayCache.subscribe/0` and make the topic name a module attr

* cleanup: Use DotcomWeb.Endpoint rather than Phoenix.PubSub for braodcast/subscribe

* cleanup: Use `DotcomWeb.Endpoint` for alert update broadcasting as well

* fix: Update translations

* cleanup: Abstract `Alerts.Cache.Store.subscribe/0`

* docs: Add docs for `SubwayCache.Behaviour`

* cleanup: Remove unnecessary `handle_info` call

* livebook: Move "No alerts!" section to the top

---------

Co-authored-by: Cristen Jones <cjones3@mbta.com>

* refactor: Simplify boundary between `<.alerts_commuter_rail_status />` and `SystemStatus.CommuterRail.commuter_rail_status/0` (#2750)

* tests: Update `CommuterRailStatusTest` setup to use alerts instead of CR status output

* livebook: Add livebooks that set up CR status edge cases

* refactor: Have `<.alerts_commuter_rail_status />` use structured train/service impact info instead of unstructured `alert_counts`

* cleanup: Remove explicit `serivce_today?` in backend struct (in favor of `status`: `:no_scheduled_service`)

* tests: Update `Dotcom.SystemStatus.CommuterRailTest` to not assert on `alert_counts`

* cleanup: Remove `alert_counts`

* cleanup: Have `commuter_rail_status/0` return a list instead of a map

* cleanup: Remove a layer of excess nesting in `<.alerts_commuter_rail_status />`

* cleanup: Restore `count_or_time/1`

* gettext: Update translations

* fix integration tests

* update failing JS test

* fix broken smoke test

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Josh Larson <jlarson@mbta.com>
Co-authored-by: Paul Swartz <pswartz@mbta.com>
Co-authored-by: Anthony Shull <ashull@mbta.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: cdong-lgtm <cdong@mbta.com>
thecristen added a commit that referenced this pull request Oct 14, 2025
* chore: phoenix_live_view config

* chore: remove unused searchbar form

* chore: remove existing search page

# Conflicts:
#	lib/dotcom_web/controllers/search_controller.ex
#	test/dotcom_web/controllers/search_controller_test.exs

* chore: update phoenix_live_view

* deps(mix): add live_isolated_component

* feat(Live.SearchPage): interactive search UI

* temporary: Faker in all envs

* update translations

* feedback: nicer stream situation

- avoids disappearing results while loading
- displays total result count
- removes "load more" when end has been reached

* patch broken hit highlight

not sure why this broke now

* update for new backend format

* feat(SearchHits): formatted search hits (#2753)

* fix: Don't pattern-match on the string `"Now"` (#2733)

* fix: Show Orange Line headways in Schedule Finder (#2734)

* cleanup: Remove redundant Green Line schedule accordion (#2735)

* chore: Replace commuter-rail alerts page with a LiveView (#2732)

* fix: Remove trip planner from `robots.txt` to allow search engines to crawl it (#2738)

* fix: Images in embedded alerts with no descriptions (#2736)

* fix: Don't double-wrap alerts-page LiveViews in `container` elements (#2739)

* cleanup: Remove old `MTicket` plug (#2740)

* fix(cms): handle case where _format=json is not the last item

The previous documentation indicated that `_format=json` would always be
the final item in the query string. This is not always the case, so our
replacement strategy needs to handle it appearing anywhere.

We do this with a regular expression which can get find the string in
any location, and replace it with either an empty string (if it's at
the beginning or end) or a single `&` if it's in the middle

Test cases are also updated to handle all three positions.

* [Translate] system status (#2730)

* fix: Use the correct URL for the commuter rail LiveView and add tests (#2737)

* feat(Components): CR survey banner (#2743)

* feat(Components): CR survey banner

* add the survey banner to commuter rail pages

* fix(TripPlan.Loops): refine interline logic (#2746)

to be considered a loop for merging legs, legs must be on the same route.

* Monthly upgrade (#2742)

* build(deps): bump actions/upload-pages-artifact from 3 to 4 (#2709)

Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-pages-artifact/releases)
- [Commits](actions/upload-pages-artifact@v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-pages-artifact
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump axios from 1.8.2 to 1.12.2 (#2747)

Bumps [axios](https://github.com/axios/axios) from 1.8.2 to 1.12.2.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](axios/axios@v1.8.2...v1.12.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-version: 1.12.2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Localization for the datepicker in dotcom (#2749)

* localization test

* extract

* fix: Alert counts for multi-trip alerts in commuter rail status (#2744)

* fix: Don't crash the planned disruptions page if an alert is recurring and "until further notice" (#2751)

* Update base.csv (#2752)

Adding in "The RIDE" to list of terms to not translate.

* chore(deps): bump tmp and artillery (#2745)

Removes [tmp](https://github.com/raszi/node-tmp). It's no longer used after updating ancestor dependency [artillery](https://github.com/artilleryio/artillery). These dependencies need to be updated together.


Removes `tmp`

Updates `artillery` from 2.0.22 to 2.0.26
- [Release notes](https://github.com/artilleryio/artillery/releases)
- [Commits](artilleryio/artillery@artillery-2.0.22...artillery-2.0.26)

---
updated-dependencies:
- dependency-name: tmp
  dependency-version: 
  dependency-type: indirect
- dependency-name: artillery
  dependency-version: 2.0.26
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump aws-actions/configure-aws-credentials from 4 to 5 (#2748)

Bumps [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) from 4 to 5.
- [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases)
- [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md)
- [Commits](aws-actions/configure-aws-credentials@v4...v5)

---
updated-dependencies:
- dependency-name: aws-actions/configure-aws-credentials
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat(SearchHits): formatted search hits

* Improve search hit text and icon formatting
- Add file name text wrap
- Prevent icons from shrinking thanks to flexbox

* fix(TimetableLoader): distinguish error vs empty (#2755)

* feedback(SearchHits): more times

* chore: delete more things

* chore: delete known unused templates + styles (#2756)

* fix: contain input in narrow screen width

* feat: add bus stop id

* fix: restore tailwind for the JS-based dropdown

* feat: Live-update subway status on subway alerts page (#2675)

* feat: Live-update subway status on subway alerts page

* Update gettext reference line numbers

* fix: Dialyzer errors

* cleanup: Call system status directly on init

* cleanup: Abstract `SubwayCache.subscribe/0` and make the topic name a module attr

* cleanup: Use DotcomWeb.Endpoint rather than Phoenix.PubSub for braodcast/subscribe

* cleanup: Use `DotcomWeb.Endpoint` for alert update broadcasting as well

* fix: Update translations

* cleanup: Abstract `Alerts.Cache.Store.subscribe/0`

* docs: Add docs for `SubwayCache.Behaviour`

* cleanup: Remove unnecessary `handle_info` call

* livebook: Move "No alerts!" section to the top

---------

Co-authored-by: Cristen Jones <cjones3@mbta.com>

* refactor: Simplify boundary between `<.alerts_commuter_rail_status />` and `SystemStatus.CommuterRail.commuter_rail_status/0` (#2750)

* tests: Update `CommuterRailStatusTest` setup to use alerts instead of CR status output

* livebook: Add livebooks that set up CR status edge cases

* refactor: Have `<.alerts_commuter_rail_status />` use structured train/service impact info instead of unstructured `alert_counts`

* cleanup: Remove explicit `serivce_today?` in backend struct (in favor of `status`: `:no_scheduled_service`)

* tests: Update `Dotcom.SystemStatus.CommuterRailTest` to not assert on `alert_counts`

* cleanup: Remove `alert_counts`

* cleanup: Have `commuter_rail_status/0` return a list instead of a map

* cleanup: Remove a layer of excess nesting in `<.alerts_commuter_rail_status />`

* cleanup: Restore `count_or_time/1`

* gettext: Update translations

* fix integration tests

* update failing JS test

* fix broken smoke test

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Josh Larson <jlarson@mbta.com>
Co-authored-by: Paul Swartz <pswartz@mbta.com>
Co-authored-by: Anthony Shull <ashull@mbta.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: cdong-lgtm <cdong@mbta.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Josh Larson <jlarson@mbta.com>
Co-authored-by: Paul Swartz <pswartz@mbta.com>
Co-authored-by: Anthony Shull <ashull@mbta.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: cdong-lgtm <cdong@mbta.com>
thecristen added a commit that referenced this pull request Oct 15, 2025
* deps(mix): install algolia_ex

* format js

* remove hackney

* refactor(SearchService): search using Algolia

* feat: restore/fix click analytics

* Another translation update

* feedback & test fix

* feat(Live.SearchPage): interactive search UI (#2731)

* chore: phoenix_live_view config

* chore: remove unused searchbar form

* chore: remove existing search page

# Conflicts:
#	lib/dotcom_web/controllers/search_controller.ex
#	test/dotcom_web/controllers/search_controller_test.exs

* chore: update phoenix_live_view

* deps(mix): add live_isolated_component

* feat(Live.SearchPage): interactive search UI

* temporary: Faker in all envs

* update translations

* feedback: nicer stream situation

- avoids disappearing results while loading
- displays total result count
- removes "load more" when end has been reached

* patch broken hit highlight

not sure why this broke now

* update for new backend format

* feat(SearchHits): formatted search hits (#2753)

* fix: Don't pattern-match on the string `"Now"` (#2733)

* fix: Show Orange Line headways in Schedule Finder (#2734)

* cleanup: Remove redundant Green Line schedule accordion (#2735)

* chore: Replace commuter-rail alerts page with a LiveView (#2732)

* fix: Remove trip planner from `robots.txt` to allow search engines to crawl it (#2738)

* fix: Images in embedded alerts with no descriptions (#2736)

* fix: Don't double-wrap alerts-page LiveViews in `container` elements (#2739)

* cleanup: Remove old `MTicket` plug (#2740)

* fix(cms): handle case where _format=json is not the last item

The previous documentation indicated that `_format=json` would always be
the final item in the query string. This is not always the case, so our
replacement strategy needs to handle it appearing anywhere.

We do this with a regular expression which can get find the string in
any location, and replace it with either an empty string (if it's at
the beginning or end) or a single `&` if it's in the middle

Test cases are also updated to handle all three positions.

* [Translate] system status (#2730)

* fix: Use the correct URL for the commuter rail LiveView and add tests (#2737)

* feat(Components): CR survey banner (#2743)

* feat(Components): CR survey banner

* add the survey banner to commuter rail pages

* fix(TripPlan.Loops): refine interline logic (#2746)

to be considered a loop for merging legs, legs must be on the same route.

* Monthly upgrade (#2742)

* build(deps): bump actions/upload-pages-artifact from 3 to 4 (#2709)

Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-pages-artifact/releases)
- [Commits](actions/upload-pages-artifact@v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-pages-artifact
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump axios from 1.8.2 to 1.12.2 (#2747)

Bumps [axios](https://github.com/axios/axios) from 1.8.2 to 1.12.2.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](axios/axios@v1.8.2...v1.12.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-version: 1.12.2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Localization for the datepicker in dotcom (#2749)

* localization test

* extract

* fix: Alert counts for multi-trip alerts in commuter rail status (#2744)

* fix: Don't crash the planned disruptions page if an alert is recurring and "until further notice" (#2751)

* Update base.csv (#2752)

Adding in "The RIDE" to list of terms to not translate.

* chore(deps): bump tmp and artillery (#2745)

Removes [tmp](https://github.com/raszi/node-tmp). It's no longer used after updating ancestor dependency [artillery](https://github.com/artilleryio/artillery). These dependencies need to be updated together.


Removes `tmp`

Updates `artillery` from 2.0.22 to 2.0.26
- [Release notes](https://github.com/artilleryio/artillery/releases)
- [Commits](artilleryio/artillery@artillery-2.0.22...artillery-2.0.26)

---
updated-dependencies:
- dependency-name: tmp
  dependency-version: 
  dependency-type: indirect
- dependency-name: artillery
  dependency-version: 2.0.26
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump aws-actions/configure-aws-credentials from 4 to 5 (#2748)

Bumps [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) from 4 to 5.
- [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases)
- [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md)
- [Commits](aws-actions/configure-aws-credentials@v4...v5)

---
updated-dependencies:
- dependency-name: aws-actions/configure-aws-credentials
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat(SearchHits): formatted search hits

* Improve search hit text and icon formatting
- Add file name text wrap
- Prevent icons from shrinking thanks to flexbox

* fix(TimetableLoader): distinguish error vs empty (#2755)

* feedback(SearchHits): more times

* chore: delete more things

* chore: delete known unused templates + styles (#2756)

* fix: contain input in narrow screen width

* feat: add bus stop id

* fix: restore tailwind for the JS-based dropdown

* feat: Live-update subway status on subway alerts page (#2675)

* feat: Live-update subway status on subway alerts page

* Update gettext reference line numbers

* fix: Dialyzer errors

* cleanup: Call system status directly on init

* cleanup: Abstract `SubwayCache.subscribe/0` and make the topic name a module attr

* cleanup: Use DotcomWeb.Endpoint rather than Phoenix.PubSub for braodcast/subscribe

* cleanup: Use `DotcomWeb.Endpoint` for alert update broadcasting as well

* fix: Update translations

* cleanup: Abstract `Alerts.Cache.Store.subscribe/0`

* docs: Add docs for `SubwayCache.Behaviour`

* cleanup: Remove unnecessary `handle_info` call

* livebook: Move "No alerts!" section to the top

---------

Co-authored-by: Cristen Jones <cjones3@mbta.com>

* refactor: Simplify boundary between `<.alerts_commuter_rail_status />` and `SystemStatus.CommuterRail.commuter_rail_status/0` (#2750)

* tests: Update `CommuterRailStatusTest` setup to use alerts instead of CR status output

* livebook: Add livebooks that set up CR status edge cases

* refactor: Have `<.alerts_commuter_rail_status />` use structured train/service impact info instead of unstructured `alert_counts`

* cleanup: Remove explicit `serivce_today?` in backend struct (in favor of `status`: `:no_scheduled_service`)

* tests: Update `Dotcom.SystemStatus.CommuterRailTest` to not assert on `alert_counts`

* cleanup: Remove `alert_counts`

* cleanup: Have `commuter_rail_status/0` return a list instead of a map

* cleanup: Remove a layer of excess nesting in `<.alerts_commuter_rail_status />`

* cleanup: Restore `count_or_time/1`

* gettext: Update translations

* fix integration tests

* update failing JS test

* fix broken smoke test

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Josh Larson <jlarson@mbta.com>
Co-authored-by: Paul Swartz <pswartz@mbta.com>
Co-authored-by: Anthony Shull <ashull@mbta.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: cdong-lgtm <cdong@mbta.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Josh Larson <jlarson@mbta.com>
Co-authored-by: Paul Swartz <pswartz@mbta.com>
Co-authored-by: Anthony Shull <ashull@mbta.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: cdong-lgtm <cdong@mbta.com>

* fix flawed substring

this broke on Freetown's stop address

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Josh Larson <jlarson@mbta.com>
Co-authored-by: Paul Swartz <pswartz@mbta.com>
Co-authored-by: Anthony Shull <ashull@mbta.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: cdong-lgtm <cdong@mbta.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants