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

Ensure unique units are used when creating a request [#4579] #4835

Merged
merged 14 commits into from
Jan 12, 2025

Conversation

awwaiid
Copy link
Collaborator

@awwaiid awwaiid commented Dec 8, 2024

Work toward #4579

This updates the code that merges duplicate request lines together also checks that the units are the same.

@awwaiid awwaiid requested a review from dorner December 8, 2024 20:26
@awwaiid awwaiid added this to the Request Units (Packs) milestone Dec 8, 2024
cielf
cielf previously requested changes Dec 9, 2024
Copy link
Collaborator

@cielf cielf left a 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.

Example:
Screenshot 2024-12-09 at 10 32 03 AM
saving gets you
Screenshot 2024-12-09 at 10 34 07 AM

Another thing of note is that when you say yes, and there's an error, the units are disappearing?
Screenshot 2024-12-09 at 10 45 09 AM

Do you want me to put that in as a separate issue? (it's on any error, not just the packs one)

@awwaiid
Copy link
Collaborator Author

awwaiid commented Dec 10, 2024

No, I'll fix it as part of this. Need to move the check/merge up earlier in the process I think.

@awwaiid awwaiid marked this pull request as draft December 10, 2024 14:28
@awwaiid awwaiid marked this pull request as ready for review January 8, 2025 22:42
@awwaiid
Copy link
Collaborator Author

awwaiid commented Jan 8, 2025

@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.

@cielf cielf dismissed their stale review January 9, 2025 15:54

Addressed!

Copy link
Collaborator

@cielf cielf left a 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!

@awwaiid
Copy link
Collaborator Author

awwaiid commented Jan 10, 2025

@dorner over to you!

Copy link
Collaborator

@dorner dorner left a 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
Copy link
Collaborator

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?

Copy link
Collaborator Author

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 :)

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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...

Copy link
Collaborator Author

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.

@awwaiid awwaiid force-pushed the bw/no-mixed-units/4579 branch from a7a825f to 504f278 Compare January 12, 2025 02:38
@awwaiid awwaiid requested a review from dorner January 12, 2025 02:41
@dorner dorner merged commit 30575b1 into main Jan 12, 2025
22 checks passed
@dorner dorner deleted the bw/no-mixed-units/4579 branch January 12, 2025 19:22
Copy link
Contributor

@awwaiid: Your PR Ensure unique units are used when creating a request [#4579] is part of today's Human Essentials production release: 2025.01.19.
Thank you very much for your contribution!

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