Fix CacheSettingsController violations

This commit is contained in:
Pau Perez
2019-03-06 10:45:45 +01:00
parent 7e06807a11
commit bbfd35c861
3 changed files with 19 additions and 14 deletions

View File

@@ -25,7 +25,6 @@ Metrics/LineLength:
- app/controllers/admin/accounts_and_billing_settings_controller.rb
- app/controllers/admin/bulk_line_items_controller.rb
- app/controllers/admin/business_model_configuration_controller.rb
- app/controllers/admin/cache_settings_controller.rb
- app/controllers/admin/contents_controller.rb
- app/controllers/admin/customers_controller.rb
- app/controllers/admin/enterprise_fees_controller.rb

View File

@@ -310,7 +310,6 @@ Layout/EmptyLinesAroundBlockBody:
Layout/EmptyLinesAroundClassBody:
Exclude:
- 'app/controllers/admin/account_controller.rb'
- 'app/controllers/admin/cache_settings_controller.rb'
- 'app/controllers/admin/enterprise_fees_controller.rb'
- 'app/controllers/admin/inventory_items_controller.rb'
- 'app/controllers/admin/tag_rules_controller.rb'
@@ -763,7 +762,6 @@ Layout/SpaceInsideBlockBraces:
# SupportedStylesForEmptyBraces: space, no_space
Layout/SpaceInsideHashLiteralBraces:
Exclude:
- 'app/controllers/admin/cache_settings_controller.rb'
- 'app/controllers/admin/enterprise_relationships_controller.rb'
- 'app/controllers/admin/enterprise_roles_controller.rb'
- 'app/controllers/api/statuses_controller.rb'
@@ -1601,7 +1599,6 @@ Style/ClassAndModuleChildren:
- 'app/controllers/admin/account_controller.rb'
- 'app/controllers/admin/accounts_and_billing_settings_controller.rb'
- 'app/controllers/admin/business_model_configuration_controller.rb'
- 'app/controllers/admin/cache_settings_controller.rb'
- 'app/controllers/spree/store_controller_decorator.rb'
- 'app/helpers/angular_form_helper.rb'
- 'app/models/calculator/flat_percent_per_item.rb'

View File

@@ -1,18 +1,27 @@
require 'open_food_network/products_cache_integrity_checker'
class Admin::CacheSettingsController < Spree::Admin::BaseController
def edit
@results = Exchange.cachable.map do |exchange|
checker = OpenFoodNetwork::ProductsCacheIntegrityChecker.new(exchange.receiver, exchange.order_cycle)
module Admin
class CacheSettingsController < Spree::Admin::BaseController
def edit
@results = Exchange.cachable.map do |exchange|
checker = OpenFoodNetwork::ProductsCacheIntegrityChecker
.new(exchange.receiver, exchange.order_cycle)
{distributor: exchange.receiver, order_cycle: exchange.order_cycle, status: checker.ok?, diff: checker.diff}
{
distributor: exchange.receiver,
order_cycle: exchange.order_cycle,
status: checker.ok?,
diff: checker.diff
}
end
end
end
def update
Spree::Config.set(params[:preferences])
respond_to do |format|
format.html { redirect_to main_app.edit_admin_cache_settings_path }
def update
Spree::Config.set(params[:preferences])
respond_to do |format|
format.html { redirect_to main_app.edit_admin_cache_settings_path }
end
end
end
end