chore: rubocop

chore: fix api test conventions

chore: rubocop -A spec/

chore: more rubocop -A

fix failing test

rubocop fixes

removes helper methods that are in my opinion dead code

more rubocop fixes

rubocop -a --auto-gen-config
This commit is contained in:
Philipp Rothmann 2023-05-12 13:01:12 +02:00 committed by Philipp Rothmann
parent f6fb804bbe
commit fb2b4d8a8a
331 changed files with 4263 additions and 4507 deletions

View file

@ -77,11 +77,11 @@ class MultipleOrdersByArticles < OrderPdf
.includes(:article).references(:article)
.reorder('order_articles.order_id, articles.name')
.preload(:article_price) # preload not join, just in case it went missing
.preload(:order, :group_order_articles => { :group_order => :ordergroup })
.preload(:order, group_order_articles: { group_order: :ordergroup })
end
def each_order_article
order_articles.find_each_with_order(batch_size: BATCH_SIZE) { |oa| yield oa }
def each_order_article(&block)
order_articles.find_each_with_order(batch_size: BATCH_SIZE, &block)
end
def group_order_articles_for(order_article)
@ -90,7 +90,7 @@ class MultipleOrdersByArticles < OrderPdf
goas
end
def each_group_order_article_for(group_order)
group_order_articles_for(group_order).each { |goa| yield goa }
def each_group_order_article_for(group_order, &block)
group_order_articles_for(group_order).each(&block)
end
end

View file

@ -113,7 +113,7 @@ class MultipleOrdersByGroups < OrderPdf
s
end
def each_ordergroup
def each_ordergroup(&block)
ordergroups.find_in_batches_with_order(batch_size: BATCH_SIZE) do |ordergroups|
@group_order_article_batch = GroupOrderArticle
.joins(:group_order)
@ -121,8 +121,8 @@ class MultipleOrdersByGroups < OrderPdf
.where(group_orders: { ordergroup_id: ordergroups.map(&:id) })
.order('group_orders.order_id, group_order_articles.id')
.preload(group_orders: { order: :supplier })
.preload(order_article: [:article, :article_price, :order])
ordergroups.each { |ordergroup| yield ordergroup }
.preload(order_article: %i[article article_price order])
ordergroups.each(&block)
end
end
@ -130,7 +130,7 @@ class MultipleOrdersByGroups < OrderPdf
@group_order_article_batch.select { |goa| goa.group_order.ordergroup_id == ordergroup.id }
end
def each_group_order_article_for(ordergroup)
group_order_articles_for(ordergroup).each { |goa| yield goa }
def each_group_order_article_for(ordergroup, &block)
group_order_articles_for(ordergroup).each(&block)
end
end