-
-
Notifications
You must be signed in to change notification settings - Fork 491
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
Make purchase helper pick default storage location #4722
base: main
Are you sure you want to change the base?
Make purchase helper pick default storage location #4722
Conversation
Changed the purchase helper to use the default storage location of the organization first, before using any other storage locations that are available. Also added a (failing) spec to check that we can see the option on the page. Should be fixed in the next commit
8f44b71
to
bf3a652
Compare
Fixed the failing test by using the extended format of the test expectation and used `subject` to make an assertion regarding the response body.
The next step here is to apply the default storage location (if set) to donations. I see that the donations form was implemented differently from the purchases form in that we directly set the location in the form as shown here while the purchases form uses a helper function as shown here. The open question: should we switch the donation form to use a (new) method declared in |
Wouldn't switching the donation form to use the same helper as purchases do what we need here? |
I don't know of any functional reason they shouldn't behave exactly the same, fwiw. |
Added a test that when we begin to make a new donation, we have a default storage location set.
Switched to use the helper method from PurchasesHelper to set the default storage location for a donation
I think so. Why I would be hestitant to use it is separation of concerns etc. Also something strange: in commit 231b516, I added a test to check that the default storage location was being used by checking the content of the form. The test passed 🤔 which made me think that there may be something I am missing regarding the behaviour of the new donation form versus the new purchases form. Anyway in the subsequent commit e048651, I updated the form to use the method from the This should be good for another review 🙏🏿 |
Hey @lenikadali -- when a PR is ready for review, please change its status to "Open". |
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.
LGTM from a functional POV
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.
Minor suggestion, otherwise looks good.
@@ -39,7 +39,7 @@ | |||
<div class="col-xs-8 col-md-6 col-lg-3"> | |||
<%= f.association :product_drive_participant, | |||
collection: @product_drive_participants, | |||
selected: donation_form.product_drive_participant_id, | |||
selected: new_purchase_default_location(@donation), |
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.
Can we rename this method so it doesn't have purchase
in its name? You can move it to ApplicationHelper.
Resolves #4436
Description
Type of change
How Has This Been Tested?
Screenshots