Run rubocop --fix-layout and remove encoding comments

This commit is contained in:
Patrick Gansterer 2021-03-01 15:27:26 +01:00
parent fa63e6e81d
commit ea2862fdef
283 changed files with 1164 additions and 1969 deletions

View file

@ -1,4 +1,3 @@
# only works properly for open orders, at the moment
def seed_group_orders
Order.all.each do |order|
@ -6,12 +5,13 @@ def seed_group_orders
Ordergroup.all.each do |og|
# 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, updated_by_user_id: 1)
(3+rand(10)).times do
(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
goa.update_quantities rand([4, 2*unit_quantity+2].max), rand(unit_quantity)
goa.update_quantities rand([4, 2 * unit_quantity + 2].max), rand(unit_quantity)
end
end
# update totals
@ -20,8 +20,8 @@ def seed_group_orders
end
end
def seed_order(options={})
options[:article_ids] ||= (options[:supplier]||Supplier.find(options[:supplier_id])).articles.map(&:id)
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