mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Style ScopeVariantToHub
This commit is contained in:
@@ -191,7 +191,6 @@ Layout/EmptyLines:
|
||||
- 'lib/open_food_network/reports/bulk_coop_report.rb'
|
||||
- 'lib/open_food_network/sales_tax_report.rb'
|
||||
- 'lib/open_food_network/scope_product_to_hub.rb'
|
||||
- 'lib/open_food_network/scope_variant_to_hub.rb'
|
||||
- 'lib/open_food_network/xero_invoices_report.rb'
|
||||
- 'lib/spree/core/controller_helpers/order_decorator.rb'
|
||||
- 'lib/tasks/cache.rake'
|
||||
@@ -648,7 +647,6 @@ Layout/SpaceAroundEqualsInParameterDefault:
|
||||
- 'lib/open_food_network/enterprise_issue_validator.rb'
|
||||
- 'lib/open_food_network/order_cycle_form_applicator.rb'
|
||||
- 'lib/open_food_network/permissions.rb'
|
||||
- 'lib/open_food_network/scope_variant_to_hub.rb'
|
||||
- 'lib/open_food_network/tag_rule_applicator.rb'
|
||||
- 'lib/open_food_network/xero_invoices_report.rb'
|
||||
- 'lib/spree/money_decorator.rb'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module OpenFoodNetwork
|
||||
class ScopeVariantToHub
|
||||
def initialize(hub, variant_overrides=nil)
|
||||
def initialize(hub, variant_overrides = nil)
|
||||
@hub = hub
|
||||
@variant_overrides = variant_overrides || VariantOverride.indexed(@hub)
|
||||
end
|
||||
@@ -11,7 +11,6 @@ module OpenFoodNetwork
|
||||
variant.instance_variable_set :@variant_override, @variant_overrides[variant]
|
||||
end
|
||||
|
||||
|
||||
module ScopeVariantToHub
|
||||
def price
|
||||
@variant_override.andand.price || super
|
||||
@@ -39,7 +38,7 @@ module OpenFoodNetwork
|
||||
end
|
||||
end
|
||||
|
||||
def decrement!(attribute, by=1)
|
||||
def decrement!(attribute, by = 1)
|
||||
if attribute == :count_on_hand && @variant_override.andand.stock_overridden?
|
||||
@variant_override.decrement_stock! by
|
||||
else
|
||||
@@ -47,7 +46,7 @@ module OpenFoodNetwork
|
||||
end
|
||||
end
|
||||
|
||||
def increment!(attribute, by=1)
|
||||
def increment!(attribute, by = 1)
|
||||
if attribute == :count_on_hand && @variant_override.andand.stock_overridden?
|
||||
@variant_override.increment_stock! by
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user