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: add handling for retrieve estimates on new shuttle creation #1059

Merged
merged 4 commits into from
Dec 20, 2024

Conversation

meagharty
Copy link
Contributor

Summary of changes

Asana Ticket: Follow up on "🏹 Implement "Create/Edit Shuttle Route Definition" - Time to Next Stop"

  • Add fetching of stop data (lat/long) when the initial shuttle hasn't been created yet
  • Add explicit error handling for when there is only one stop defined for a direction

Part of this is similar to what the Map component does (Ecto.assoc_loaded? & calling preload) but if those values aren't set yet, then this uses a virtual field display_stop mirroring display_stop_id. This isn't the most elegant solution, opening this as a draft for now.

Reviewer Checklist

  • Meets ticket's acceptance criteria
  • Any new or changed functions have typespecs
  • Tests were added for any new functionality (don't just rely on Codecov)
  • This branch was deployed to the staging environment and is currently running with no unexpected increase in warnings, and no errors or crashes.

@meagharty meagharty requested a review from lemald December 18, 2024 15:13
lib/arrow/shuttles.ex Outdated Show resolved Hide resolved
lib/arrow/shuttles.ex Outdated Show resolved Hide resolved
@@ -24,6 +25,7 @@ defmodule Arrow.Shuttles.RouteStop do
field :stop_sequence, :integer
field :time_to_next_stop, :decimal
field :display_stop_id, :string, virtual: true
field :display_stop, :map, virtual: true
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'm not sure we really need both display_stop and display_stop_id but it reduces the changes required across other pieces of work.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's useful to have both because, in the case of an Arrow stop, the display_stop_id is the value from the stop_id column, not the actual database primary key. We could definitely work around that with some helper function to get the display ID for a given display_stop, but I'm not sure how that would play along with form rendering. Anyhow, long story short I think it's fine to keep it this way.

@meagharty meagharty requested a review from lemald December 18, 2024 16:40
Copy link
Member

@lemald lemald left a comment

Choose a reason for hiding this comment

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

There's the minor thing about the type on display_stop, but otherwise looks good to me! 👍

@meagharty meagharty force-pushed the meag/add-initial-retrieve-estimates branch from 95d142b to 3437f93 Compare December 19, 2024 19:02
@meagharty meagharty marked this pull request as ready for review December 19, 2024 23:45
@meagharty meagharty requested a review from lemald December 19, 2024 23:45
@meagharty meagharty force-pushed the meag/add-initial-retrieve-estimates branch from cca5c23 to cac89f1 Compare December 20, 2024 14:21
@meagharty meagharty requested a review from lemald December 20, 2024 14:23
Copy link
Member

@lemald lemald left a comment

Choose a reason for hiding this comment

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

👍

@meagharty meagharty force-pushed the meag/add-initial-retrieve-estimates branch from cac89f1 to 3d0a0bf Compare December 20, 2024 14:32
@meagharty meagharty merged commit a99baf7 into master Dec 20, 2024
10 checks passed
@meagharty meagharty deleted the meag/add-initial-retrieve-estimates branch December 20, 2024 17:17
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.

2 participants