fix small.{en,nl}.seeds.rb
this handles problems unveiled by 18ed8934d916962b3271645eec6f5f8965f6722e
This commit is contained in:
parent
a1bf2a36ad
commit
661fab0e0c
3 changed files with 16 additions and 15 deletions
|
@ -7,7 +7,7 @@ def seed_group_orders
|
|||
# 20% of the order-ordergroup combinations don't order
|
||||
next if rand(10) < 2
|
||||
# order 3..12 times a random article
|
||||
go = og.group_orders.create!(order: order)
|
||||
go = og.group_orders.create!(order: order, updated_by_user_id: 1)
|
||||
(3+rand(10)).times do
|
||||
goa = go.group_order_articles.find_or_create_by!(order_article: order.order_articles.offset(rand(noas)).first)
|
||||
unit_quantity = goa.order_article.price.unit_quantity
|
||||
|
@ -23,5 +23,6 @@ end
|
|||
def seed_order(options={})
|
||||
options[:article_ids] ||= (options[:supplier]||Supplier.find(options[:supplier_id])).articles.map(&:id)
|
||||
options[:created_by_user_id] ||= 1
|
||||
options[:updated_by_user_id] ||= 1
|
||||
Order.create! options
|
||||
end
|
||||
|
|
|
@ -141,13 +141,6 @@ Article.create!(:name => "Chia seeds", :supplier_id => 4, :article_category_id =
|
|||
Article.create!(:name => "Coconut grated", :supplier_id => 4, :article_category_id => 13, :unit => "kg", :availability => true, :price => 0.55E0, :tax => 6.0, :deposit => 0.0, :unit_quantity => 1, :order_number => ":b3f65e4")
|
||||
|
||||
|
||||
## Orders & OrderArticles
|
||||
|
||||
seed_order(supplier_id: 1, starts: 2.days.ago, ends: 5.days.from_now)
|
||||
seed_order(supplier_id: 3, starts: 2.days.ago, ends: 5.days.from_now)
|
||||
seed_order(supplier_id: 2, starts: 2.days.ago, ends: 4.days.from_now)
|
||||
|
||||
|
||||
## Members & groups
|
||||
|
||||
User.create!(:id => 1, :nick => "admin", :password => "secret", :first_name => "Anton", :last_name => "Administrator", :email => "admin@foo.test", :created_on => 'Wed, 15 Jan 2014 16:15:33 UTC +00:00')
|
||||
|
@ -178,6 +171,13 @@ Membership.create!(:group_id => 3, :user_id => 5)
|
|||
Membership.create!(:group_id => 4, :user_id => 5)
|
||||
|
||||
|
||||
## Orders & OrderArticles
|
||||
|
||||
seed_order(supplier_id: 1, starts: 2.days.ago, ends: 5.days.from_now)
|
||||
seed_order(supplier_id: 3, starts: 2.days.ago, ends: 5.days.from_now)
|
||||
seed_order(supplier_id: 2, starts: 2.days.ago, ends: 4.days.from_now)
|
||||
|
||||
|
||||
## GroupOrders & such
|
||||
|
||||
seed_group_orders
|
||||
|
|
|
@ -141,13 +141,6 @@ Article.create!(:name => "Chia zaad", :supplier_id => 4, :article_category_id =>
|
|||
Article.create!(:name => "Cocos Rasp", :supplier_id => 4, :article_category_id => 13, :unit => "kg", :availability => true, :price => 0.55E0, :tax => 6.0, :deposit => 0.0, :unit_quantity => 1, :order_number => ":b3f65e4")
|
||||
|
||||
|
||||
## Orders & OrderArticles
|
||||
|
||||
seed_order(supplier_id: 1, starts: 2.days.ago, ends: 5.days.from_now)
|
||||
seed_order(supplier_id: 3, starts: 2.days.ago, ends: 5.days.from_now)
|
||||
seed_order(supplier_id: 2, starts: 2.days.ago, ends: 4.days.from_now)
|
||||
|
||||
|
||||
## Members & groups
|
||||
|
||||
User.create!(:id => 1, :nick => "admin", :password => "secret", :first_name => "Anton", :last_name => "Administrator", :email => "admin@foo.test", :created_on => 'Wed, 15 Jan 2014 16:15:33 UTC +00:00')
|
||||
|
@ -178,6 +171,13 @@ Membership.create!(:group_id => 3, :user_id => 5)
|
|||
Membership.create!(:group_id => 4, :user_id => 5)
|
||||
|
||||
|
||||
## Orders & OrderArticles
|
||||
|
||||
seed_order(supplier_id: 1, starts: 2.days.ago, ends: 5.days.from_now)
|
||||
seed_order(supplier_id: 3, starts: 2.days.ago, ends: 5.days.from_now)
|
||||
seed_order(supplier_id: 2, starts: 2.days.ago, ends: 4.days.from_now)
|
||||
|
||||
|
||||
## GroupOrders & such
|
||||
|
||||
seed_group_orders
|
||||
|
|
Loading…
Reference in a new issue