Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Avoid collapsing green line and Mattapan line rows unless needed #2415

Merged
merged 8 commits into from
Mar 6, 2025

Conversation

joshlarson
Copy link
Contributor

This PR fixes a few edge cases in the homepage subway status component where it was unnecessarily collapsing green line rows together, or collapsing Mattapan alerts into Red line (which we decided it should never do).

Two Green line rows when other data would cause a collapse (Green line shouldn't be collapsed, but other rows should be)

Before

Screenshot 2025-03-05 at 11 50 27 AM

After

Screenshot 2025-03-05 at 11 47 38 AM

Green line and Mattapan both have extra rows (Green should be collapsed / Mattapan should remain visible)

Before

Screenshot 2025-03-05 at 11 49 54 AM

After

Screenshot 2025-03-05 at 11 49 11 AM

Asana Tickets

Blocked by:

@joshlarson joshlarson requested a review from a team as a code owner March 5, 2025 16:52
@joshlarson joshlarson added the dev-green Deploy to dev-green label Mar 5, 2025
Base automatically changed from jdl/subway-status/collapsing-logic-tests to main March 5, 2025 16:57
@joshlarson joshlarson force-pushed the jdl/system-status/prioritized-collapsing branch from deab2ed to abdb8f1 Compare March 5, 2025 16:59
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.

The before and after is soooo good!

I almost feel like there might be a meta-programming-ish thing one could implement around the three collapse functions, since they all work so similarly. But I didn't leave a blocking comment on it, since this implementation is probably clearer anyway, despite the repetition.

Requesting changes for adjusting the "active now" part of your test code.

@joshlarson joshlarson force-pushed the jdl/system-status/prioritized-collapsing branch from c18768d to dd36096 Compare March 5, 2025 20:58
@@ -131,7 +131,7 @@ defmodule DotcomWeb.Components.SystemStatus.SubwayStatus do
@route_ids
|> Enum.map(&{&1, subway_status |> Map.get(&1)})
|> Enum.flat_map(&rows_for_route/1)
|> maybe_collapse_rows()
|> collapse_rows_if_needed()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess I could name this back to maybe_collapse_rows(). I can't remember now why I changed it.

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.

🚀

@joshlarson joshlarson merged commit 1c6bea6 into main Mar 6, 2025
21 checks passed
@joshlarson joshlarson deleted the jdl/system-status/prioritized-collapsing branch March 6, 2025 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev-green Deploy to dev-green
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants