Skip to content

Commit

Permalink
Shipping cost added for distributions with shipping
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitali-railsfactory authored and dorner committed Aug 22, 2023
1 parent 3e0041b commit 4884522
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit 4884522

Please sign in to comment.