diff --git a/db/suburb_seeds.rb b/db/suburb_seeds.rb index 054be282ce..8085551be5 100644 --- a/db/suburb_seeds.rb +++ b/db/suburb_seeds.rb @@ -11,7 +11,7 @@ module SuburbSeeder connection = ActiveRecord::Base.connection() - puts "-- Seeding australian suburbs" + puts "-- Seeding Australian suburbs" connection.execute(" INSERT INTO suburbs (postcode,name,state_id,latitude,longitude) VALUES (200,$$AUSTRALIAN NATIONAL UNIVERSITY$$,#{state_id_act},-35.277272,149.117136), @@ -16894,4 +16894,4 @@ module SuburbSeeder (6060,$$Yokine South$$,#{state_id_wa},-31.9097,115.849); ") end -end \ No newline at end of file +end diff --git a/lib/tasks/dev.rake b/lib/tasks/dev.rake index 495343fc27..5d9e2809e0 100644 --- a/lib/tasks/dev.rake +++ b/lib/tasks/dev.rake @@ -72,11 +72,7 @@ namespace :openfoodweb do FactoryGirl.create(:distributor_enterprise, :address => Spree::Address.find_by_zipcode("3040")) end - unless Spree::ShippingMethod.all.any? { |sm| sm.calculator.is_a? OpenFoodWeb::Calculator::Itemwise } - FactoryGirl.create(:itemwise_shipping_method) - end - - # -- Enterprise Users + # -- Enterprise users unless Spree::User.count > 1 puts "[#{task_name}] Seeding enterprise users" @@ -93,6 +89,13 @@ namespace :openfoodweb do puts " Distributor User created: #{u.email}/#{pw} (" + u.enterprise_roles.map{ |er| er.enterprise.name}.join(", ") + ")" end + # -- Enterprise fees + unless EnterpriseFee.count > 1 + Enterprise.is_distributor.each do |distributor| + FactoryGirl.create(:enterprise_fee, enterprise: distributor) + end + end + # -- Products unless Spree::Product.count > 0 puts "[#{task_name}] Seeding products" @@ -104,7 +107,7 @@ namespace :openfoodweb do ProductDistribution.create(:product => prod1, :distributor => Enterprise.is_distributor[0], - :shipping_method => Spree::ShippingMethod.first) + :enterprise_fee => Enterprise.is_distributor[0].enterprise_fees.first) prod2 = FactoryGirl.create(:product, @@ -114,7 +117,7 @@ namespace :openfoodweb do ProductDistribution.create(:product => prod2, :distributor => Enterprise.is_distributor[1], - :shipping_method => Spree::ShippingMethod.first) + :enterprise_fee => Enterprise.is_distributor[1].enterprise_fees.first) prod3 = FactoryGirl.create(:product, :name => 'Beef - 5kg Trays', :price => 50.00, @@ -123,7 +126,7 @@ namespace :openfoodweb do ProductDistribution.create(:product => prod3, :distributor => Enterprise.is_distributor[2], - :shipping_method => Spree::ShippingMethod.first) + :enterprise_fee => Enterprise.is_distributor[2].enterprise_fees.first) end end end