Skip to content

Conversation

@thecristen
Copy link
Collaborator

Summary of changes

Asana Ticket: Service selector: show dropdown to toggle between types of schedules

Most of these features are in parity with our current schedule finder:

  • Default selection should reflect the current service day
    • If there happens to be no service on the current day, the default selection should be whichever service is next chronologically. e.g. if I look at 351 over the weekend (it doesn't run on weekends), it should select the weekday one.
  • Service descriptions and group names (in <optgroup>) are edited for clarity, including dates when helpful
    • Holidays are split out so we can show them one at a time
  • Shows a no service message at times.

I also attempted to add some quality of life improvements around clarifying things like planned work, or extra service. Look at a commuter rail or Green Line for more on that.

I ended up building off of DotcomWeb.ScheduleController.LineController.services/2 (which powers the current Schedule Finder), though I ended up discarding its calculation of default_service? because the one I wrote (captured in :is_now? and :next_available? properties) works better (especially for cases with modified service). Ha!

Still to come

  • All the testing
  • More complete translations, maybe some refactoring around that
  • Followup tickets for the following:
    • Verifying the accessibility of this interaction
    • Maybe showing a nicer loading state??

@thecristen thecristen requested a review from a team as a code owner December 18, 2025 18:25
@thecristen thecristen added the dev-green Deploy to dev-green label Dec 18, 2025
@joshlarson joshlarson added dev-blue Deploy to dev-blue and removed dev-green Deploy to dev-green labels Dec 23, 2025
Copy link
Contributor

@joshlarson joshlarson left a comment

Choose a reason for hiding this comment

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

Two preliminary code-level comments, plus...

As long as we're filtering out No Schools services, should we add in a way for a trip in the daily schedule to be marked as a school trip? The current behavior shows those trips on the M-Th schedule, with no way to tell that they don't run every Monday thru Thursday.

I imagine that that's in follow-up ticket territory, but just wanted to flag it, in case!

end
end

defp sort_services_by_date(service, start_date) do
Copy link
Contributor

Choose a reason for hiding this comment

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

Naming nit: Technically this function doesn't sort a list of services - it's a service/start-date mapper.

Comment on lines +454 to +462
defp sort_groups({group_name, _}) do
[
"Schedules, ends",
"Schedules, starts",
"Holiday",
"Extra"
]
|> Enum.find_index(&String.contains?(group_name, &1))
end
Copy link
Contributor

Choose a reason for hiding this comment

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

At a glance, this looks like the sort of thing that bit us with the Now: prefix in system status. Specifically, I think this will preclude translating Schedules and starts/ends, since once those strings are translated, String.contains? won't work anymore.

I think the solution is to push string-logic to the very last possible moment before they land in an HTML template, so instead of constructing and then parsing strings in the backend, I would try to have this code construct more elaborate structs, and serialize them as strings in the frontend.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're totally right!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev-blue Deploy to dev-blue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants