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

4333 remove inventory items #4607

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

4333 remove inventory items #4607

wants to merge 19 commits into from

Conversation

dorner
Copy link
Collaborator

@dorner dorner commented Aug 23, 2024

Resolves #4333

Description

Definitely do not merge this.

This removes InventoryItems and all associated functionality, with the exception of the records themselves and the basic associations. It also removes Kit allocation and deallocation.

Need to get all tests passing, and then do some exhaustive manual testing afterwards.

dorner added 17 commits May 10, 2024 16:54
# Conflicts:
#	app/controllers/storage_locations_controller.rb
#	app/models/item.rb
#	app/services/item_create_service.rb
#	spec/controllers/donations_controller_spec.rb
#	spec/models/inventory_item_spec.rb
#	spec/models/organization_stats_spec.rb
#	spec/requests/distributions_requests_spec.rb
#	spec/requests/purchases_requests_spec.rb
#	spec/requests/storage_locations_requests_spec.rb
#	spec/services/allocate_kit_inventory_service_spec.rb
#	spec/services/deallocate_kit_inventory_service_spec.rb
#	spec/system/distribution_system_spec.rb
# Conflicts:
#	app/controllers/distributions_controller.rb
#	spec/rails_helper.rb
@dorner dorner marked this pull request as ready for review October 13, 2024 21:08
Copy link
Collaborator

@awwaiid awwaiid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial notes; I'll need to read through in particular the adjustment (increase/decrease) cleanup in detail

app/controllers/audits_controller.rb Show resolved Hide resolved
Comment on lines +67 to +71
if @change_by.positive?
KitAllocateEvent.publish(@kit, @storage_location.id, @change_by)
else
KitDeallocateEvent.publish(@kit, @storage_location.id, -@change_by)
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better

app/controllers/kits_controller.rb Show resolved Hide resolved
to_storage_location: storage_location.id,
to_storage_location: storage_location,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Good looking.

@@ -207,16 +196,6 @@ def self.csv_export_headers
["Name", "Barcodes", "Base Item", "Quantity"]
end

# TODO remove this method once read_events? is true everywhere
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good

app/services/distribution_itemized_breakdown_service.rb Outdated Show resolved Hide resolved
app/services/donation_itemized_breakdown_service.rb Outdated Show resolved Hide resolved
@@ -40,9 +37,6 @@ def items_below_minimum_quantity
if @inventory
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dorner same, etc down

app/services/item_create_service.rb Show resolved Hide resolved
Comment on lines 112 to 113
<% else %>
<%= render partial: "inventory_item_row",
collection: @storage_location.inventory_items.joins(:item).where(items: { active: true }),
locals: { version_date: params[:version_date] } %>
<% end %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer need the else at all, and maybe don't need to elsif @legacy_inventory block either?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh I fell into that trap. We do need this because it tracks inventory from before event sourcing was introduced.

@cielf
Copy link
Collaborator

cielf commented Oct 26, 2024

@dorner " It also removes Kit allocation and deallocation."
Please tell me more about this --for instance, does that mean that we should be able to handle donating kits now? ( it's failing a test of donating kits where there was no kits allocated, then deallocating them -- but it would have before the change as well.)

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.

Explore disabling InventoryItem
3 participants