From 147a74f00539f68592ca15b358d8f2004836cd0b Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Mon, 16 Apr 2018 10:18:18 +0200 Subject: [PATCH] Fix Rubocop violations reported by Code Climate --- app/models/content_configuration.rb | 4 ++-- app/models/enterprise.rb | 12 ++++++------ app/models/product_importer.rb | 8 ++++---- .../orders_and_fulfillments_report.rb | 4 ++-- lib/open_food_network/packing_report.rb | 4 ++-- lib/open_food_network/permissions.rb | 4 ++-- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/models/content_configuration.rb b/app/models/content_configuration.rb index d83d7f14ef..47038bcb9e 100644 --- a/app/models/content_configuration.rb +++ b/app/models/content_configuration.rb @@ -46,9 +46,9 @@ class ContentConfiguration < Spree::Preferences::FileConfiguration preference :community_forum_url, :string, default: "http://community.openfoodnetwork.org" preference :footer_links_md, :text, default: <<-EOS.strip_heredoc [Newsletter sign-up](/) - + [News](/) - + [Calendar](/) EOS diff --git a/app/models/enterprise.rb b/app/models/enterprise.rb index 5e04d3b498..82618e4e2e 100644 --- a/app/models/enterprise.rb +++ b/app/models/enterprise.rb @@ -290,17 +290,17 @@ class Enterprise < ActiveRecord::Base # Map backend cases to front end cases. case cat when "producer_sells_any" - :producer_hub # Producer hub who sells own and others produce and supplies other hubs. + :producer_hub # Producer hub who sells own and others produce and supplies other hubs. when "producer_sells_own" - :producer_shop # Producer with shopfront and supplies other hubs. + :producer_shop # Producer with shopfront and supplies other hubs. when "producer_sells_none" - :producer # Producer only supplies through others. + :producer # Producer only supplies through others. when "non_producer_sells_any" - :hub # Hub selling others products in order cycles. + :hub # Hub selling others products in order cycles. when "non_producer_sells_own" - :hub # Wholesaler selling through own shopfront? Does this need a separate name? Should it exist? + :hub # Wholesaler selling through own shopfront? Does this need a separate name? Should it exist? when "non_producer_sells_none" - :hub_profile # Hub selling outside the system. + :hub_profile # Hub selling outside the system. end end diff --git a/app/models/product_importer.rb b/app/models/product_importer.rb index fe33379289..13fc0152da 100644 --- a/app/models/product_importer.rb +++ b/app/models/product_importer.rb @@ -365,11 +365,11 @@ class ProductImporter @import_settings[entry['supplier_id'].to_s]['defaults'].each do |attribute, setting| case setting['mode'] when 'overwrite_all' - object.assign_attributes(attribute => setting['value']) + object.assign_attributes(attribute => setting['value']) when 'overwrite_empty' - if object.send(attribute).blank? or (attribute == 'on_hand' and entry['on_hand_nil']) - object.assign_attributes(attribute => setting['value']) - end + if object.send(attribute).blank? or (attribute == 'on_hand' and entry['on_hand_nil']) + object.assign_attributes(attribute => setting['value']) + end end end end diff --git a/lib/open_food_network/orders_and_fulfillments_report.rb b/lib/open_food_network/orders_and_fulfillments_report.rb index d80abb3a64..1de8c3ff40 100644 --- a/lib/open_food_network/orders_and_fulfillments_report.rb +++ b/lib/open_food_network/orders_and_fulfillments_report.rb @@ -245,8 +245,8 @@ module OpenFoodNetwork proc { |line_items| line_items.first.order.bill_address.andand.address2 }, proc { |line_items| line_items.first.order.bill_address.andand.city }, proc { |line_items| line_items.first.order.bill_address.andand.zipcode }, - proc { |line_items| line_items.first.order.bill_address.andand.state } -] + proc { |line_items| line_items.first.order.bill_address.andand.state } + ] else [ proc { |line_items| line_items.first.product.supplier.name }, proc { |line_items| line_items.first.product.name }, diff --git a/lib/open_food_network/packing_report.rb b/lib/open_food_network/packing_report.rb index 24cc33906f..4c9eb783ec 100644 --- a/lib/open_food_network/packing_report.rb +++ b/lib/open_food_network/packing_report.rb @@ -81,8 +81,8 @@ module OpenFoodNetwork { group_by: proc { |line_item| line_item.product }, sort_by: proc { |product| product.name } }, { group_by: proc { |line_item| line_item.full_name }, - sort_by: proc { |full_name| full_name } } -] + sort_by: proc { |full_name| full_name } } + ] else # supplier_rows orders # table_items = supplier_rows orders diff --git a/lib/open_food_network/permissions.rb b/lib/open_food_network/permissions.rb index c4f347a4fb..d303af5681 100644 --- a/lib/open_food_network/permissions.rb +++ b/lib/open_food_network/permissions.rb @@ -70,8 +70,8 @@ module OpenFoodNetwork produced = Spree::Order.with_line_items_variants_and_products_outer. where( "spree_orders.distributor_id IN (?) AND spree_products.supplier_id IN (?)", - granted_distributors, - related_enterprises_granting(:add_to_order_cycle, to: granted_distributors).merge(managed_enterprises.is_primary_producer) + granted_distributors, + related_enterprises_granting(:add_to_order_cycle, to: granted_distributors).merge(managed_enterprises.is_primary_producer) ).pluck(:id) Spree::Order.where(id: editable | produced)