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

feat: Make trip channel pull from ETS predictions #235

Merged
merged 10 commits into from
Nov 12, 2024
Merged

Conversation

EmmaSimon
Copy link
Contributor

@EmmaSimon EmmaSimon commented Nov 5, 2024

Summary

Ticket: Fix trip details crash when trip not in service

Update the predictions:trip:<trip_id> channel to use the same ETS table that predictions by stop are pulling from. This also better handles the case where the frontend passes an added trip ID that doesn't exist in the trips endpoint, which can happen frequently for vehicles near the end of a line. Now instead of crashing on the backend, an error is returned to the frontend.

Added tests for new behavior

@EmmaSimon EmmaSimon marked this pull request as ready for review November 6, 2024 16:33
@EmmaSimon EmmaSimon requested a review from a team as a code owner November 6, 2024 16:33
@EmmaSimon EmmaSimon changed the title feat: Create new trip v2 channel feat: Make trip channel pull from ETS predictions Nov 6, 2024
Copy link
Collaborator

@KaylaBrady KaylaBrady left a comment

Choose a reason for hiding this comment

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

Nice work! A few tiny comments

lib/mobile_app_backend/predictions/stream_subscriber.ex Outdated Show resolved Hide resolved
predictions_by_stop: %{Stop.id() => %{Prediction.id() => Prediction.t()}},
trips: %{Trip.id() => Trip.t()},
vehicles: %{Vehicle.id() => Vehicle.t()}
}

@type subscribe_trip_response :: %{
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion(non-blocking): add the new trip_id field here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I don't understand what you mean?

Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a trip_id field added to the map here, I think it would be worth adding to the typespec

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohh, okay yes, updated

lib/mobile_app_backend_web/channels/user_socket.ex Outdated Show resolved Hide resolved
@EmmaSimon EmmaSimon merged commit 4620ff2 into main Nov 12, 2024
5 checks passed
@EmmaSimon EmmaSimon deleted the es-trip-v2 branch November 12, 2024 19:51
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