mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Fix Rubocop violations reported by Code Climate
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 },
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user