Skip to content

fix(StopEvent): assign date when including schedule#1009

Open
runkelcorey wants to merge 4 commits into
masterfrom
fix-API-AAY
Open

fix(StopEvent): assign date when including schedule#1009
runkelcorey wants to merge 4 commits into
masterfrom
fix-API-AAY

Conversation

@runkelcorey
Copy link
Copy Markdown
Contributor

Summary of changes

Asana Ticket: 🐞 Unhandled stop_events query

  1. Fixes typo in README
  2. Assigns start_date as the schedule date when including schedules in stop_events queries. Not assigning the date caused this bug
  3. Updates ScheduleView to format dates using a date field
  4. Exposes service_id as attribute of schedules; this enables (2) and also seems useful for consumers (although I guess it hadn't been needed thus far)

How were these changes validated?

  1. Updates StopEventControllerTest to check that the service ids returned by each schedule match the expected service ids

What questions should reviewers consider?

  1. Are there edge cases where returning the service_id could mislead consumers?
  2. Is there a cleaner way to assign the date? I feel like date_seconds and date represent just enough difference that a bigger refactor would be needed but idk

@runkelcorey runkelcorey requested a review from a team as a code owner May 11, 2026 15:58
@runkelcorey runkelcorey requested review from jzimbel-mbta and removed request for a team May 11, 2026 15:58
@runkelcorey runkelcorey added the bug Something isn't working label May 11, 2026
@runkelcorey runkelcorey self-assigned this May 11, 2026
Copy link
Copy Markdown
Member

@jzimbel-mbta jzimbel-mbta left a comment

Choose a reason for hiding this comment

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

I think this looks good overall, but (as you also pointed out in the PR description) I wonder if there's a different way to associate a stop event date with a schedule than Map.put-ing it right on the struct.

Comment thread apps/api_web/lib/api_web/views/schedule_view.ex Outdated
Comment thread apps/api_web/lib/api_web/views/stop_event_view.ex Outdated
@runkelcorey
Copy link
Copy Markdown
Contributor Author

I think this looks good overall, but (as you also pointed out in the PR description) I wonder if there's a different way to associate a stop event date with a schedule than Map.put-ing it right on the struct.

Agreed. I moved the logic to associate dates and schedules out of Schedule and into StopEvent. That's also unconventional but respects the fact that stop events from 2 dates may occur

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants