-
-
Notifications
You must be signed in to change notification settings - Fork 499
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
Bank Org Request Export - Include Custom Units #4608
base: main
Are you sure you want to change the base?
Conversation
Use fixes specific values instead of calculated ones in most places
Hrm. I did an export that looked clean, but then I added a request that just had pads with 233 units. I got a "no implicit conversion from nil to integer" on line 99 of export_request_service. (Note: I made partner group 1 have all the categories, and gave pads a category of Period Supplies first). |
@cielf Fixed! The issue was similar to the one in another PR, where "some item -" was being used instead of "some item" when the default-unit was selected. |
|
||
# It's possible that the unit is no longer valid, so we'd | ||
# add that individually | ||
if item_request.request_unit.present? && !item.request_units.pluck(:name).include?(item_request.request_unit) |
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 grab all the request_units at the top rather than doing a separate DB query per item here?
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 followed another alternative of switching to a set and adding rather than re-testing; avoids the extra DB call.
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'm confused - this avoids an extra DB call per item, but you're still doing a DB call per item. I think you might be missing an includes
somewhere? Or am I reading this wrong?
Also pluralize consistently
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.
One last question.
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 ran an export that seemed to work, then added a request for 1 box of pads. Then I exported again, and got a Type Error no implicit conversion from nil to integer. It failed at export_request_service.rb line 99, and it does look like it failed on the newly added item. I think headers_with_indexes might be to blame -- that there was a new item/unit combo, but headers_with_indexes was already defined, hence the boxes column header not defined, hence boom.
Implements #4405, adding custom units to request export.