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:
parent
f6fb804bbe
commit
fb2b4d8a8a
331 changed files with 4263 additions and 4507 deletions
|
|
@ -4,10 +4,10 @@ class Delivery < StockEvent
|
|||
|
||||
scope :recent, -> { order('created_at DESC').limit(10) }
|
||||
|
||||
validates_presence_of :supplier_id
|
||||
validates :supplier_id, presence: true
|
||||
validate :stock_articles_must_be_unique
|
||||
|
||||
accepts_nested_attributes_for :stock_changes, :allow_destroy => :true
|
||||
accepts_nested_attributes_for :stock_changes, allow_destroy: :true
|
||||
|
||||
def new_stock_changes=(stock_change_attributes)
|
||||
for attributes in stock_change_attributes
|
||||
|
|
@ -16,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
|
||||
stock_changes.map { |stock_change| stock_change.stock_article.id }.include? article.id
|
||||
end
|
||||
|
||||
def sum(type = :gross)
|
||||
|
|
@ -39,8 +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?
|
||||
errors.add(:base, I18n.t('model.delivery.each_stock_article_must_be_unique'))
|
||||
end
|
||||
return if 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue