mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Requested changes on VariantOverrride
- change was not exactly equivalent, so reverting + rubo comment
This commit is contained in:
@@ -52,7 +52,14 @@ class VariantOverride < ApplicationRecord
|
||||
return
|
||||
end
|
||||
|
||||
update!(count_on_hand: (count_on_hand || 0) + quantity)
|
||||
# rubocop:disable Rails/SkipsModelValidations
|
||||
# Cf. conversation https://github.com/openfoodfoundation/openfoodnetwork/pull/12647
|
||||
if quantity > 0
|
||||
increment! :count_on_hand, quantity
|
||||
elsif quantity < 0
|
||||
decrement! :count_on_hand, -quantity
|
||||
end
|
||||
# rubocop:enable Rails/SkipsModelValidations
|
||||
end
|
||||
|
||||
def default_stock?
|
||||
|
||||
Reference in New Issue
Block a user