Skip to content

Discarded Storage Location and Inactive Item #4713

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

Merged
merged 3 commits into from
Oct 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ def random_record_for_org(org, klass)
end
Organization.seed_items(sf_org)

# At least one of the items is marked as inactive
Organization.all.each do |org|
org.items.order(created_at: :desc).last.update(active: false)
end

# Assign a value to some organization items to verify totals are working
Organization.all.each do |org|
org.items.where(value_in_cents: 0).limit(10).each do |item|
Expand Down Expand Up @@ -417,11 +422,19 @@ def random_record_for_org(org, klass)
inventory.square_footage = 20_000
end

inactive_storage = StorageLocation.find_or_create_by!(name: "Inactive Storage Location") do |inventory|
inventory.address = "Unknown"
inventory.organization = pdx_org
inventory.warehouse_type = StorageLocation::WAREHOUSE_TYPES[2]
inventory.square_footage = 5_000
inventory.discarded_at = DateTime.now
end

#
# Define all the InventoryItem for each of the StorageLocation
#
StorageLocation.all.each do |sl|
sl.organization.items.each do |item|
sl.organization.items.active.each do |item|
InventoryItem.create!(
storage_location: sl,
item: item,
Expand Down