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.Form): use Ecto.Schema to create a form #2159

Merged
merged 4 commits into from
Aug 27, 2024

Conversation

thecristen
Copy link
Collaborator

Summary of changes

Asana Ticket: a part of Trip planner form Phoenix.LiveComponent

It's my first foray using Ecto, and really my first time in-depth with working with forms in Phoenix in general, but I've been working on a form with this schema as a base! This only includes the from and to locations for now, and the leave/arrive choice, mode selection, and wheelchair: true choices will be added later. Open to feedback on how I might improve this.

  • For each location (origin/destination) I wanted to be able to capture the coordinates, name, and stop ID (if a stop is chosen), since these are what get passed into OTP.
  • I had a lot of trouble getting the validation to do what I wanted, so I ended up writing a custom one that adds an error to the location field if any of those sub-fields were invalid/missing. But I'd really rather have been able to make cast_embed(:from, required: true, required_message: "Please select an origin") or its invalid_message counterpart work.

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.

@thecristen thecristen requested a review from a team as a code owner August 23, 2024 18:59
@thecristen thecristen requested a review from bklebe August 23, 2024 18:59
also improve the location validation with separate error messages for each location
@thecristen thecristen merged commit 775f1fe into main Aug 27, 2024
23 checks passed
@thecristen thecristen deleted the cbj/trip-planner-form branch August 27, 2024 14:07
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.

3 participants