-
Notifications
You must be signed in to change notification settings - Fork 2
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(shuttles): call Changeset.apply_action after uploading xlsx #1083
Conversation
0b854e8
to
babb617
Compare
59aae6a
to
e36bba5
Compare
2a0281c
to
56834c5
Compare
) | ||
stop_ids | ||
|> elem(direction_id |> Atom.to_string() |> String.to_integer()) | ||
|> get_new_route_stops_changeset_with_uploaded_stops(direction_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to utilize the route_stop's changeset validation within this function (for the stop_id validation etc). Things got very verbose with that. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 suggestion re: spreadsheet parsing, and 2 small stylistic nits.
Good to go after you address them as you see fit 🙂
%{ | ||
direction_id: direction_id, | ||
stop_sequence: i, | ||
display_stop_id: Integer.to_string(stop_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion
Would it make sense to convert the stop IDs to strings right when we parse them from the uploaded spreadsheet over in DefinitionUpload
?
I know we're only working with bus stop IDs right now, which are generally numeric in format, but unless we actually need to do arithmetic on them I think it would be safest to convert them to strings immediately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, done.
I kept the check that it's an integer in the upload since that is what is in the Shuttle Conventions doc for a shuttle stop replacing rail.
@@ -490,7 +492,7 @@ defmodule ArrowWeb.ShuttleViewLive do | |||
|
|||
changeset = Ecto.Changeset.put_assoc(changeset, :routes, new_routes) | |||
|
|||
socket = socket |> assign(:form, to_form(changeset)) |> update_map(changeset) | |||
socket = socket |> assign(:form, to_form(changeset)) |> update_map() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
It doesn't look like there's a difference between assign/2
(takes a KW-list) and assign/3
(takes a key and a value) when only one assign is getting set or updated. Would you mind sticking with one or the other in this PR, for consistency's sake?
fbc6ef6
to
e5149cd
Compare
e5149cd
to
9f26918
Compare
Summary of changes
Asana Ticket: [extra] 🏹🐛 [edit only] Upload Shuttle Definition XLSX then Retrieve Estimates - retrieve estimate does nothing (websocket crash)
Reviewer Checklist