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,5 +1,4 @@
class Delivery < StockEvent
belongs_to :supplier
belongs_to :invoice, optional: true
@ -17,7 +16,7 @@ class Delivery < StockEvent
end
def includes_article?(article)
self.stock_changes.map{|stock_change| stock_change.stock_article.id}.include? article.id
self.stock_changes.map { |stock_change| stock_change.stock_article.id }.include? article.id
end
def sum(type = :gross)
@ -26,12 +25,12 @@ class Delivery < StockEvent
article = sc.stock_article
quantity = sc.quantity
case type
when :net
total += quantity * article.price
when :gross
total += quantity * article.gross_price
when :fc
total += quantity * article.fc_price
when :net
total += quantity * article.price
when :gross
total += quantity * article.gross_price
when :fc
total += quantity * article.fc_price
end
end
total
@ -40,9 +39,8 @@ class Delivery < StockEvent
protected
def stock_articles_must_be_unique
unless stock_changes.reject{|sc| sc.marked_for_destruction?}.map {|sc| sc.stock_article.id}.uniq!.nil?
unless stock_changes.reject { |sc| sc.marked_for_destruction? }.map { |sc| sc.stock_article.id }.uniq!.nil?
errors.add(:base, I18n.t('model.delivery.each_stock_article_must_be_unique'))
end
end
end