-
-
Notifications
You must be signed in to change notification settings - Fork 504
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 inventory quantity errors to be tied to organization, not storage location (Fixes #4647) #4804
Fix inventory quantity errors to be tied to organization, not storage location (Fixes #4647) #4804
Conversation
… below recommended and minimum levels
… storage location quantity
Hey @McEileen I took it out for a spin, and it seems to be working well. I do like the idea of putting the recommended level message on a new line, though. Please do that. |
@dorner - can you give this a technical once-over? Thx. |
if inventory_check_result.minimum_alert.present? && inventory_check_result.recommended_alert.present? | ||
flash[:alert] = inventory_check_result.minimum_alert | ||
flash[:alert] += "\n" | ||
flash[:alert] += inventory_check_result.recommended_alert | ||
elsif inventory_check_result.minimum_alert.present? | ||
flash[:alert] = inventory_check_result.minimum_alert | ||
elsif inventory_check_result.recommended_alert.present? | ||
flash[:alert] = inventory_check_result.recommended_alert |
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.
if inventory_check_result.minimum_alert.present? && inventory_check_result.recommended_alert.present? | |
flash[:alert] = inventory_check_result.minimum_alert | |
flash[:alert] += "\n" | |
flash[:alert] += inventory_check_result.recommended_alert | |
elsif inventory_check_result.minimum_alert.present? | |
flash[:alert] = inventory_check_result.minimum_alert | |
elsif inventory_check_result.recommended_alert.present? | |
flash[:alert] = inventory_check_result.recommended_alert | |
alerts = [inventory_check_result.minimum_alert, inventory_check_result.recommended_alert] | |
merged_alert = alerts.compact.join("\n") | |
flash[:alert] = merged_alert if merged_alert.present? |
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.
This is a really lovely refactor. Thanks for suggesting it. See 6d00cbc.
spec/factories/storage_locations.rb
Outdated
@@ -59,5 +59,38 @@ | |||
end | |||
end | |||
end | |||
|
|||
trait :with_items_mixed do |
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.
This is only used in one place and is pretty complex. I'd much rather just have that one spec create this data rather than adding it to the factory.
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.
Sure thing. See 6d00cbc.
Thanks! |
@McEileen: Your PR |
Resolves #4647
Description
distributions_controller_spec
andinventory_check_service_spec
to confirm the changes.with_items_mixed
, to thestorage_locations
factory. I contemplated updating the existingwith_items
trait to support more than one type of item. I decided against that, because I didn't want to alter everywhere that already used thewith_items
trait. I am curious to hear feedback about this decision and the new trait.Type of change
How Has This Been Tested?
inventory_check_service_spec
anddistributions_controller_spec
, I added automated tests for the bug. Before implementing a solution, I verified that the tests failed.Screenshots
Error message for distribution that causes both minimum level and recommended level error