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(TripPlanner): add itinerary tags #1883

Merged
merged 13 commits into from
Feb 14, 2024

Conversation

thecristen
Copy link
Collaborator

@thecristen thecristen commented Feb 8, 2024

Summary of changes

Asana Ticket: Trip planner backend changes and Trip planner frontend changes

image

Lots of changes here!

Using the OpenTripPlannerClient

I've extracted OpenTripPlanner-touching code into a standalone open_trip_planner_client library, which I hope to move into our Github org and share with @mbta/mobile-app soon.

So far it primarily implements the plan/3 function to query OTP's plan, but under the hood it parses input arguments, dynamically constructs the GraphQL query, and handles very light parsing (mainly just error handling), while also applying tags (thanks mbta/mobile_app_backend#34 !).

This PR updates our codebase to use the client's implementation. Half of the changes in this PR involved removing various bits of our code and adjusting others.

Mocking and test data generation

I added two long-recommend libraries, Mox and ExMachina, along with Faker for generating data.

The client library exposes a behavior, OpenTripPlannerClient.Behaviour, which we use with the Mox library to provide some mocked functionality in tests.

Separately, we replace the MockPlanner functions with test factories created using ExMachina and Faker.

The other half of the bulk of changes in this PR are from refactoring many tests.

Adding itinerary tags to the UI

Each itinerary should have at most one tag, and all tagged itineraries are shown before the rest.


General checks

  • Are the changes organized into self-contained commits with descriptive and well-formatted commit messages? This is a good practice that can facilitate easier reviews.
  • Testing. Do the changes include relevant passing updates to tests? This includes updating screenshots. Preferably tests are run locally to verify that there are no test failures created by these changes, before opening a PR.
  • Tech debt. Have you checked for tech debt you can address in the area you're working in? This can be a good time to address small issues, or create Asana tickets for larger issues.

- deprecate `TripPlan.Api` behaviour and the modules using it (`TripPlan.Api.MockPlanner` and `TripPlan.Api.OpenTripPlanner`) in favor of using the client (`OpenTripPlannerClient` and its behaviour `OpenTripPlannerClient.Behaviour`).
- remove `TripPlan.plan/4` function
@thecristen thecristen requested a review from a team as a code owner February 8, 2024 23:04
@thecristen thecristen requested review from anthonyshull and removed request for a team February 8, 2024 23:04
@thecristen thecristen added the dev-blue Deploy to dev-blue label Feb 8, 2024
@thecristen
Copy link
Collaborator Author

Tagging has been updated. This screenshot shows both (1) tagged itineraries shown before untagged and (2) tag prioritization (#2 is labelled just "least walking" instead of both "least walking" and "shortest trip")

image

@thecristen thecristen merged commit 227af7a into feat/trip-planner-improvements Feb 14, 2024
16 of 18 checks passed
@thecristen thecristen deleted the cbj/with-client branch February 14, 2024 23:39
@thecristen thecristen removed the dev-blue Deploy to dev-blue label Feb 22, 2024
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