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

Shipping cost added to seed data for distributions with shipping #3853

Merged
Changes from all commits
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
5 changes: 4 additions & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,14 @@ def seed_quantity(item_name, organization, storage_location, quantity)
20.times.each do
storage_location = random_record_for_org(pdx_org, StorageLocation)
stored_inventory_items_sample = storage_location.inventory_items.sample(20)
delivery_method = Distribution.delivery_methods.keys.sample
shipping_cost = delivery_method == "shipped" ? (rand(20.0..100.0)).round(2).to_s : nil
distribution = Distribution.create!(storage_location: storage_location,
partner: random_record_for_org(pdx_org, Partner),
organization: pdx_org,
issued_at: Faker::Date.between(from: 4.days.ago, to: Time.zone.today),
delivery_method: Distribution.delivery_methods.keys.sample,
delivery_method: delivery_method,
shipping_cost: shipping_cost,
comment: 'Urgent')

stored_inventory_items_sample.each do |stored_inventory_item|
Expand Down
Loading