-
-
Notifications
You must be signed in to change notification settings - Fork 510
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
Ensure unique units are used when creating a request [#4579] #4835
Conversation
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.
We have a functional problem. The confirmation doesn't show both the units, but the user won't have any idea why.
Another thing of note is that when you say yes, and there's an error, the units are disappearing?
Do you want me to put that in as a separate issue? (it's on any error, not just the packs one)
No, I'll fix it as part of this. Need to move the check/merge up earlier in the process I think. |
Conflicts: spec/system/partners/children_system_spec.rb
Errors are then reported up to the UI but not saved to the database; this is what the controller and rails forms expects. [#4579]
@cielf ready for review! I ended up moving the validation earlier, so that it can create PartnerRequest in-memory even with mixed units which lets rails keep the data to go back to the form. |
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.
Looks pretty good to me!
@dorner over to you! |
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.
Just one question - this is more or less good to go IMO.
|
||
if @partner_request.valid? | ||
create_service.initialize_only |
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.
Just curious why this one follows a different pattern than the others? Seems like initialize_only
returns the service anyway?
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.
Because I did this one first and was trying to make it more like the create_service.call
in the def create
above. I'll make the others like this one, and then if you don't like it then I'll make all of them the original way :)
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.
There we go -- now they all look exactly the same as a dedicated action on the create_service
instance. The code after that uses the instance, which whether it is the validate
or the create
can always be treated as a service wrapper around a request.
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.
er... hm. ok one min...
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.
@dorner I didn't realize that the family and children request services were yet another wrapper layer for the request service. Kinda weird. But rather than fix it I went back the other way and now they all look the same in the controllers.
a7a825f
to
504f278
Compare
@awwaiid: Your PR |
Work toward #4579
This updates the code that merges duplicate request lines together also checks that the units are the same.