mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-30 06:31:16 +00:00
Merge pull request #2199 from coopdevs/auto-correct-cops
Auto correct cops
This commit is contained in:
@@ -84,22 +84,6 @@ Layout/AlignParameters:
|
||||
- 'spec/lib/open_food_network/user_balance_calculator_spec.rb'
|
||||
- 'spec/support/request/authentication_workflow.rb'
|
||||
|
||||
# Offense count: 8
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentOneStep, IndentationWidth.
|
||||
# SupportedStyles: case, end
|
||||
Layout/CaseIndentation:
|
||||
Exclude:
|
||||
- 'app/models/enterprise.rb'
|
||||
- 'app/models/product_importer.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
Layout/ClosingParenthesisIndentation:
|
||||
Exclude:
|
||||
- 'app/overrides/add_capture_order_shortcut.rb'
|
||||
- 'spec/serializers/variant_serializer_spec.rb'
|
||||
|
||||
# Offense count: 8
|
||||
# Cop supports --auto-correct.
|
||||
Layout/CommentIndentation:
|
||||
@@ -261,16 +245,6 @@ Layout/EmptyLines:
|
||||
- 'spec/support/delayed_job_helper.rb'
|
||||
- 'spec/support/matchers/table_matchers.rb'
|
||||
|
||||
# Offense count: 6
|
||||
# Cop supports --auto-correct.
|
||||
Layout/EmptyLinesAroundAccessModifier:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/order_cycles_controller.rb'
|
||||
- 'app/controllers/spree/admin/shipping_methods_controller_decorator.rb'
|
||||
- 'app/helpers/angular_form_builder.rb'
|
||||
- 'spec/helpers/products_helper_spec.rb'
|
||||
- 'spec/support/request/web_helper.rb'
|
||||
|
||||
# Offense count: 66
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
@@ -362,44 +336,6 @@ Layout/EmptyLinesAroundClassBody:
|
||||
- 'lib/open_food_network/rack_request_blocker.rb'
|
||||
- 'lib/open_food_network/reports/bulk_coop_report.rb'
|
||||
|
||||
# Offense count: 7
|
||||
# Cop supports --auto-correct.
|
||||
Layout/EmptyLinesAroundExceptionHandlingKeywords:
|
||||
Exclude:
|
||||
- 'app/controllers/checkout_controller.rb'
|
||||
- 'app/controllers/enterprises_controller.rb'
|
||||
- 'app/controllers/shop_controller.rb'
|
||||
- 'app/models/spree/adjustment_decorator.rb'
|
||||
- 'app/models/spree/tax_rate_decorator.rb'
|
||||
- 'lib/tasks/users.rake'
|
||||
- 'spec/features/admin/overview_spec.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Cop supports --auto-correct.
|
||||
Layout/EmptyLinesAroundMethodBody:
|
||||
Exclude:
|
||||
- 'app/controllers/checkout_controller.rb'
|
||||
- 'app/controllers/spree/admin/reports_controller_decorator.rb'
|
||||
- 'app/serializers/api/product_serializer.rb'
|
||||
- 'lib/open_food_network/orders_and_fulfillments_report.rb'
|
||||
|
||||
# Offense count: 11
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
|
||||
Layout/EmptyLinesAroundModuleBody:
|
||||
Exclude:
|
||||
- 'app/helpers/add_to_cart_helper.rb'
|
||||
- 'app/helpers/groups_helper.rb'
|
||||
- 'lib/open_food_network/column_preference_defaults.rb'
|
||||
- 'lib/open_food_network/group_buy_report.rb'
|
||||
- 'lib/open_food_network/order_cycle_form_applicator.rb'
|
||||
- 'lib/open_food_network/order_grouper.rb'
|
||||
- 'lib/open_food_network/variant_and_line_item_naming.rb'
|
||||
- 'spec/models/spree/ability_spec.rb'
|
||||
- 'spec/support/request/distribution_helper.rb'
|
||||
- 'spec/support/request/ui_component_helper.rb'
|
||||
|
||||
# Offense count: 55
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
|
||||
@@ -443,15 +379,6 @@ Layout/ExtraSpacing:
|
||||
- 'spec/spec_helper.rb'
|
||||
- 'spec/support/request/web_helper.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
||||
# SupportedStyles: consistent, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
||||
Layout/FirstParameterIndentation:
|
||||
Exclude:
|
||||
- 'lib/open_food_network/permissions.rb'
|
||||
- 'spec/serializers/variant_serializer_spec.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: SupportedStyles, IndentationWidth.
|
||||
@@ -459,13 +386,6 @@ Layout/FirstParameterIndentation:
|
||||
Layout/IndentArray:
|
||||
EnforcedStyle: consistent
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: IndentationWidth.
|
||||
Layout/IndentAssignment:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/admin/reports_controller_decorator.rb'
|
||||
|
||||
# Offense count: 52
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
||||
@@ -489,14 +409,6 @@ Layout/IndentHash:
|
||||
- 'spec/lib/open_food_network/order_cycle_form_applicator_spec.rb'
|
||||
- 'spec/support/request/authentication_workflow.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
|
||||
Layout/IndentHeredoc:
|
||||
Exclude:
|
||||
- 'app/models/content_configuration.rb'
|
||||
|
||||
# Offense count: 21
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
@@ -566,19 +478,6 @@ Layout/LeadingCommentSpace:
|
||||
- 'spec/support/matchers/select2_matchers.rb'
|
||||
- 'spec/support/request/authentication_workflow.rb'
|
||||
|
||||
# Offense count: 10
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
# SupportedStyles: symmetrical, new_line, same_line
|
||||
Layout/MultilineArrayBraceLayout:
|
||||
Exclude:
|
||||
- 'lib/open_food_network/customers_report.rb'
|
||||
- 'lib/open_food_network/order_cycle_management_report.rb'
|
||||
- 'lib/open_food_network/orders_and_fulfillments_report.rb'
|
||||
- 'lib/open_food_network/packing_report.rb'
|
||||
- 'lib/open_food_network/xero_invoices_report.rb'
|
||||
- 'spec/archive/features/consumer/checkout_spec.rb'
|
||||
|
||||
# Offense count: 44
|
||||
# Cop supports --auto-correct.
|
||||
Layout/MultilineBlockLayout:
|
||||
|
||||
@@ -106,6 +106,7 @@ module Admin
|
||||
|
||||
|
||||
protected
|
||||
|
||||
def collection
|
||||
return Enterprise.where("1=0") unless json_request?
|
||||
return order_cycles_from_set if params[:order_cycle_set]
|
||||
@@ -130,6 +131,7 @@ module Admin
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_data_for_index
|
||||
if json_request?
|
||||
# Split ransack params into all those that currently exist and new ones to limit returned ocs to recent or undated
|
||||
|
||||
@@ -84,7 +84,6 @@ class CheckoutController < Spree::CheckoutController
|
||||
customer_bill_address_id = @order.customer.bill_address.andand.id
|
||||
@order.customer.update_attributes(bill_address_attributes: new_bill_address.merge('id' => customer_bill_address_id))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def set_default_ship_address
|
||||
@@ -133,7 +132,6 @@ class CheckoutController < Spree::CheckoutController
|
||||
def advance_order_state(order)
|
||||
tries ||= 3
|
||||
order.next
|
||||
|
||||
rescue ActiveRecord::StaleObjectError
|
||||
retry unless (tries -= 1).zero?
|
||||
false
|
||||
|
||||
@@ -33,7 +33,6 @@ class EnterprisesController < BaseController
|
||||
begin
|
||||
Rails.application.routes.recognize_path( "/#{ params[:permalink].to_s }" )
|
||||
render text: params[:permalink], status: 409
|
||||
|
||||
rescue ActionController::RoutingError
|
||||
render text: params[:permalink], status: 200
|
||||
end
|
||||
|
||||
@@ -18,7 +18,6 @@ class ShopController < BaseController
|
||||
products_json = filter(renderer.products_json)
|
||||
|
||||
render json: products_json
|
||||
|
||||
rescue OpenFoodNetwork::CachedProductsRenderer::NoProducts
|
||||
render status: 404, json: ''
|
||||
end
|
||||
|
||||
@@ -222,7 +222,6 @@ Spree::Admin::ReportsController.class_eval do
|
||||
csv_file_name = "#{params[:report_type]}_#{timestamp}.csv"
|
||||
|
||||
render_report(@report.header, @table, params[:csv], csv_file_name)
|
||||
|
||||
end
|
||||
|
||||
def products_and_inventory
|
||||
@@ -320,9 +319,9 @@ Spree::Admin::ReportsController.class_eval do
|
||||
reports[:order_cycle_management][:description] =
|
||||
render_to_string(partial: 'order_cycle_management_description', layout: false, locals: {report_types: report_types[:order_cycle_management]}).html_safe
|
||||
reports[:packing][:description] =
|
||||
render_to_string(partial: 'packing_description', layout: false, locals: {report_types: report_types[:packing]}).html_safe
|
||||
render_to_string(partial: 'packing_description', layout: false, locals: {report_types: report_types[:packing]}).html_safe
|
||||
reports[:sales_tax][:description] =
|
||||
render_to_string(partial: 'sales_tax_description', layout: false, locals: {report_types: report_types[:sales_tax]}).html_safe
|
||||
render_to_string(partial: 'sales_tax_description', layout: false, locals: {report_types: report_types[:sales_tax]}).html_safe
|
||||
|
||||
# Return only reports the user is authorized to view.
|
||||
reports.select { |action| can? action, :report }
|
||||
|
||||
@@ -44,6 +44,7 @@ module Spree
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_hubs
|
||||
@hubs = Enterprise.managed_by(spree_current_user).is_distributor.sort_by!{ |d| [(@shipping_method.has_distributor? d) ? 0 : 1, d.name] }
|
||||
end
|
||||
|
||||
@@ -18,5 +18,4 @@ module AddToCartHelper
|
||||
def available_order_cycles_for(order, product)
|
||||
DistributionChangeValidator.new(order).available_order_cycles_for(product)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -36,6 +36,7 @@ class AngularFormBuilder < ActionView::Helpers::FormBuilder
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def angular_name(method)
|
||||
"#{@object_name}[#{@fields_for_record_name}_attributes][{{ $index }}][#{method}]"
|
||||
end
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
module GroupsHelper
|
||||
|
||||
def link_to_service(baseurl, name, html_options = {})
|
||||
return if name.blank?
|
||||
html_options = html_options.merge target: '_blank'
|
||||
@@ -19,5 +18,4 @@ module GroupsHelper
|
||||
def strip_url(url)
|
||||
url.andand.sub(/^https?:\/\//i, '')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -44,12 +44,12 @@ class ContentConfiguration < Spree::Preferences::FileConfiguration
|
||||
preference :footer_pinterest_url, :string, default: ""
|
||||
preference :footer_email, :string, default: "hello@openfoodnetwork.org"
|
||||
preference :community_forum_url, :string, default: "http://community.openfoodnetwork.org"
|
||||
preference :footer_links_md, :text, default: <<-EOS
|
||||
[Newsletter sign-up](/)
|
||||
preference :footer_links_md, :text, default: <<-EOS.strip_heredoc
|
||||
[Newsletter sign-up](/)
|
||||
|
||||
[News](/)
|
||||
[News](/)
|
||||
|
||||
[Calendar](/)
|
||||
[Calendar](/)
|
||||
EOS
|
||||
|
||||
preference :footer_about_url, :string, default: "http://www.openfoodnetwork.org/ofn-local/open-food-network-australia/"
|
||||
|
||||
@@ -289,18 +289,18 @@ 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.
|
||||
when "producer_sells_own"
|
||||
:producer_shop # Producer with shopfront and supplies other hubs.
|
||||
when "producer_sells_none"
|
||||
:producer # Producer only supplies through others.
|
||||
when "non_producer_sells_any"
|
||||
: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?
|
||||
when "non_producer_sells_none"
|
||||
:hub_profile # Hub selling outside the system.
|
||||
when "producer_sells_any"
|
||||
: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.
|
||||
when "producer_sells_none"
|
||||
:producer # Producer only supplies through others.
|
||||
when "non_producer_sells_any"
|
||||
: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?
|
||||
when "non_producer_sells_none"
|
||||
:hub_profile # Hub selling outside the system.
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -364,12 +364,12 @@ class ProductImporter
|
||||
def assign_defaults(object, entry)
|
||||
@import_settings[entry['supplier_id'].to_s]['defaults'].each do |attribute, setting|
|
||||
case setting['mode']
|
||||
when 'overwrite_all'
|
||||
when 'overwrite_all'
|
||||
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'])
|
||||
when 'overwrite_empty'
|
||||
if object.send(attribute).blank? or (attribute == 'on_hand' and entry['on_hand_nil'])
|
||||
object.assign_attributes(attribute => setting['value'])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -72,7 +72,6 @@ module Spree
|
||||
skip_callback :destroy, :after, :update_adjustable
|
||||
|
||||
result = yield
|
||||
|
||||
ensure
|
||||
set_callback :save, :after, :update_adjustable
|
||||
set_callback :destroy, :after, :update_adjustable
|
||||
|
||||
@@ -51,7 +51,6 @@ module Spree
|
||||
calculator.calculable.included_in_price = true
|
||||
|
||||
result = yield
|
||||
|
||||
ensure
|
||||
self.included_in_price = old_included_in_price
|
||||
calculator.calculable.included_in_price = old_included_in_price
|
||||
|
||||
@@ -2,10 +2,10 @@ Deface::Override.new(:virtual_path => "spree/admin/orders/index",
|
||||
:name => "add_capture_order_shortcut",
|
||||
:insert_bottom => "[data-hook='admin_orders_index_row_actions']",
|
||||
:partial => 'spree/admin/orders/capture'
|
||||
)
|
||||
)
|
||||
# And align actions column (not spree standard, but looks better IMO)
|
||||
Deface::Override.new(:virtual_path => "spree/admin/orders/index",
|
||||
:name => "add_capture_order_shortcut_align",
|
||||
:set_attributes => "[data-hook='admin_orders_index_row_actions']",
|
||||
:attributes => {:class => "actions", :style => "text-align:left;"} #removes 'align-center' class
|
||||
)
|
||||
)
|
||||
|
||||
@@ -27,7 +27,6 @@ class Api::UncachedProductSerializer < ActiveModel::Serializer
|
||||
else
|
||||
object.master.price_with_fees(options[:current_distributor], options[:current_order_cycle])
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
module OpenFoodNetwork
|
||||
module ColumnPreferenceDefaults
|
||||
|
||||
private
|
||||
|
||||
# NOTE: These methods define valid column names (via hash keys)
|
||||
|
||||
@@ -41,8 +41,7 @@ module OpenFoodNetwork
|
||||
ba.phone,
|
||||
order.distributor.andand.name,
|
||||
[da.andand.address1, da.andand.address2, da.andand.city].join(" "),
|
||||
order.shipping_method.andand.name
|
||||
]
|
||||
order.shipping_method.andand.name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
module OpenFoodNetwork
|
||||
|
||||
GroupBuyVariantRow = Struct.new(:variant, :sum_quantities, :sum_max_quantities) do
|
||||
def to_row
|
||||
[variant.product.supplier.name, variant.product.name, I18n.t('admin.reports.unitsize'), variant.options_text, variant.weight, sum_quantities, sum_max_quantities]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require 'open_food_network/order_cycle_permissions'
|
||||
|
||||
module OpenFoodNetwork
|
||||
|
||||
# There are two translator classes on the boundary between Angular and Rails: On the Angular side,
|
||||
# there is the OrderCycle#dataForSubmit method, and on the Rails side is this class. I think data
|
||||
# translation is more a responsibility of Angular, so I'd be inclined to refactor this class to move
|
||||
|
||||
@@ -74,8 +74,7 @@ module OpenFoodNetwork
|
||||
order.shipping_method.andand.name,
|
||||
order.payments.first.andand.payment_method.andand.name,
|
||||
order.payments.first.amount,
|
||||
OpenFoodNetwork::UserBalanceCalculator.new(order.email, order.distributor).balance
|
||||
]
|
||||
OpenFoodNetwork::UserBalanceCalculator.new(order.email, order.distributor).balance]
|
||||
end
|
||||
|
||||
def delivery_row(order)
|
||||
@@ -92,8 +91,7 @@ module OpenFoodNetwork
|
||||
order.payments.first.amount,
|
||||
OpenFoodNetwork::UserBalanceCalculator.new(order.email, order.distributor).balance,
|
||||
has_temperature_controlled_items?(order),
|
||||
order.special_instructions
|
||||
]
|
||||
order.special_instructions]
|
||||
end
|
||||
|
||||
def filter_to_payment_method(orders)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
module OpenFoodNetwork
|
||||
|
||||
class OrderGrouper
|
||||
def initialize(rules, column_constructors)
|
||||
@rules = rules
|
||||
|
||||
@@ -36,14 +36,12 @@ module OpenFoodNetwork
|
||||
I18n.t(:report_header_ship_street), I18n.t(:report_header_ship_street_2), I18n.t(:report_header_ship_city), I18n.t(:report_header_ship_postcode), I18n.t(:report_header_ship_state),
|
||||
I18n.t(:report_header_comments), I18n.t(:report_header_sku),
|
||||
I18n.t(:report_header_order_cycle), I18n.t(:report_header_payment_method), I18n.t(:report_header_customer_code), I18n.t(:report_header_tags),
|
||||
I18n.t(:report_header_billing_street), I18n.t(:report_header_billing_street_2), I18n.t(:report_header_billing_city), I18n.t(:report_header_billing_postcode), I18n.t(:report_header_billing_state),
|
||||
]
|
||||
I18n.t(:report_header_billing_street), I18n.t(:report_header_billing_street_2), I18n.t(:report_header_billing_city), I18n.t(:report_header_billing_postcode), I18n.t(:report_header_billing_state),]
|
||||
else
|
||||
[I18n.t(:report_header_producer), I18n.t(:report_header_product), I18n.t(:report_header_variant),
|
||||
I18n.t(:report_header_amount), I18n.t(:report_header_curr_cost_per_unit), I18n.t(:report_header_total_cost),
|
||||
I18n.t(:report_header_status), I18n.t(:report_header_incoming_transport)]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def search
|
||||
@@ -247,7 +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,7 +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
|
||||
@@ -118,8 +119,7 @@ module OpenFoodNetwork
|
||||
proc { |line_items| line_items.first.product.name },
|
||||
proc { |line_items| line_items.first.full_name },
|
||||
proc { |line_items| line_items.sum { |li| li.quantity } },
|
||||
proc { |line_items| is_temperature_controlled?(line_items.first) }
|
||||
]
|
||||
proc { |line_items| is_temperature_controlled?(line_items.first) }]
|
||||
else
|
||||
[
|
||||
proc { |line_items| line_items.first.order.distributor.name },
|
||||
|
||||
@@ -69,9 +69,9 @@ module OpenFoodNetwork
|
||||
granted_distributors = related_enterprises_granted(:add_to_order_cycle, by: managed_enterprises.is_primary_producer)
|
||||
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)
|
||||
"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)
|
||||
).pluck(:id)
|
||||
|
||||
Spree::Order.where(id: editable | produced)
|
||||
|
||||
@@ -6,7 +6,6 @@ require 'open_food_network/option_value_namer'
|
||||
|
||||
module OpenFoodNetwork
|
||||
module VariantAndLineItemNaming
|
||||
|
||||
# Copied and modified from Spree::Variant
|
||||
def options_text
|
||||
values = self.option_values.joins(:option_type).order("#{Spree::OptionType.table_name}.position asc")
|
||||
|
||||
@@ -152,8 +152,7 @@ module OpenFoodNetwork
|
||||
'',
|
||||
Spree::Config.currency,
|
||||
'',
|
||||
order.paid? ? I18n.t(:y) : I18n.t(:n)
|
||||
]
|
||||
order.paid? ? I18n.t(:y) : I18n.t(:n)]
|
||||
end
|
||||
|
||||
def adjustments(order)
|
||||
|
||||
@@ -75,7 +75,6 @@ namespace :openfoodnetwork do
|
||||
ba_country = Spree::Country.find_by_name row[43]
|
||||
ba = Spree::Address.create!({firstname: row[35], lastname: row[36], address1: row[37], address2: row[38], city: row[39], zipcode: row[40], phone: row[41], state: ba_state, country: ba_country, created_at: row[44], updated_at: row[45], company: row[46]}, without_protection: true)
|
||||
user.update_column :bill_address_id, ba.id
|
||||
|
||||
rescue ActiveRecord::RecordInvalid => e
|
||||
puts "#{row[2]} - #{e.message}"
|
||||
end
|
||||
|
||||
9
script/rubocop_autocorrect
Executable file
9
script/rubocop_autocorrect
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
COP="$1"
|
||||
|
||||
bundle exec rubocop -a --only "$COP"
|
||||
git add -A
|
||||
git commit -m "Auto correct Rubocop's ${COP} cop"
|
||||
@@ -306,8 +306,7 @@ feature %q{
|
||||
within('fieldset#shipping') do
|
||||
[@distributor.name,
|
||||
@distributor.distributor_info,
|
||||
@distributor.next_collection_at
|
||||
].each do |value|
|
||||
@distributor.next_collection_at].each do |value|
|
||||
|
||||
page.should have_content value
|
||||
end
|
||||
@@ -375,8 +374,7 @@ feature %q{
|
||||
within('fieldset#shipping') do
|
||||
[@distributor_oc.name,
|
||||
@distributor_oc.distributor_info,
|
||||
@distributor_oc.next_collection_at
|
||||
].each do |value|
|
||||
@distributor_oc.next_collection_at].each do |value|
|
||||
|
||||
page.should have_content value
|
||||
end
|
||||
|
||||
@@ -132,7 +132,6 @@ feature %q{
|
||||
expect(Spree::Dash::Config.configured?).to be true
|
||||
|
||||
block.call
|
||||
|
||||
ensure
|
||||
Spree::Dash::Config.preferred_app_id = nil
|
||||
Spree::Dash::Config.preferred_site_id = nil
|
||||
|
||||
@@ -14,6 +14,7 @@ module Spree
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def make_variant_stub(product_price, variant_price)
|
||||
product = double(:product, price: product_price)
|
||||
variant = double(:variant, product: product, price: variant_price)
|
||||
|
||||
@@ -3,7 +3,6 @@ require "cancan/matchers"
|
||||
require 'support/cancan_helper'
|
||||
|
||||
module Spree
|
||||
|
||||
describe User do
|
||||
|
||||
describe "broad permissions" do
|
||||
|
||||
@@ -7,7 +7,7 @@ describe Api::VariantSerializer do
|
||||
it "includes the expected attributes" do
|
||||
expect(subject.attributes.keys).
|
||||
to include(
|
||||
:id,
|
||||
:id,
|
||||
:name_to_display,
|
||||
:is_master,
|
||||
:count_on_hand,
|
||||
@@ -21,6 +21,6 @@ describe Api::VariantSerializer do
|
||||
:price_with_fees,
|
||||
:product_name,
|
||||
:tag_list # Used to apply tag rules
|
||||
)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
module OpenFoodNetwork
|
||||
module DistributionHelper
|
||||
|
||||
def select_distribution(distributor, order_cycle=nil)
|
||||
create_enterprise_group_for distributor
|
||||
visit root_path
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
module UIComponentHelper
|
||||
|
||||
def browse_as_medium
|
||||
page.driver.resize(1024, 768)
|
||||
end
|
||||
|
||||
@@ -199,6 +199,7 @@ module WebHelper
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def wait_for_ajax
|
||||
wait_until { page.evaluate_script("$.active") == 0 }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user