mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-01 06:41:41 +00:00
Fix a few rubocop issues in reports code
This commit is contained in:
@@ -124,7 +124,6 @@ Metrics/LineLength:
|
||||
- lib/open_food_network/reports/bulk_coop_allocation_report.rb
|
||||
- lib/open_food_network/reports/line_items.rb
|
||||
- lib/open_food_network/sales_tax_report.rb
|
||||
- lib/open_food_network/users_and_enterprises_report.rb
|
||||
- lib/open_food_network/variant_and_line_item_naming.rb
|
||||
- lib/open_food_network/xero_invoices_report.rb
|
||||
- lib/spree/core/controller_helpers/respond_with_decorator.rb
|
||||
|
||||
@@ -258,14 +258,14 @@ Spree::Admin::ReportsController.class_eval do
|
||||
def describe_report(report)
|
||||
name = I18n.t(:name, scope: [:admin, :reports, report])
|
||||
description = begin
|
||||
I18n.t!(:description, scope: [:admin, :reports, report])
|
||||
I18n.t!(:description, scope: [:admin, :reports, report])
|
||||
rescue I18n::MissingTranslationData
|
||||
render_to_string(
|
||||
partial: "#{report}_description",
|
||||
layout: false,
|
||||
locals: { report_types: report_types[report] }
|
||||
).html_safe
|
||||
end
|
||||
end
|
||||
{ name: name, url: url_for_report(report), description: description }
|
||||
end
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@ module OpenFoodNetwork
|
||||
@compile_table = compile_table
|
||||
|
||||
# Convert arrays of ids to comma delimited strings
|
||||
@params[:enterprise_id_in] = @params[:enterprise_id_in].join(',') if @params[:enterprise_id_in].is_a? Array
|
||||
if @params[:enterprise_id_in].is_a? Array
|
||||
@params[:enterprise_id_in] = @params[:enterprise_id_in].join(',')
|
||||
end
|
||||
@params[:user_id_in] = @params[:user_id_in].join(',') if @params[:user_id_in].is_a? Array
|
||||
end
|
||||
|
||||
@@ -104,8 +106,17 @@ module OpenFoodNetwork
|
||||
[(a["created_at"].nil? ? 0 : 1), a["name"], b["relationship_type"], a["user_email"]] <=>
|
||||
[(b["created_at"].nil? ? 0 : 1), b["name"], a["relationship_type"], b["user_email"]]
|
||||
else
|
||||
[DateTime.parse(b["created_at"]).in_time_zone, a["name"], b["relationship_type"], a["user_email"]] <=>
|
||||
[DateTime.parse(a["created_at"]).in_time_zone, b["name"], a["relationship_type"], b["user_email"]]
|
||||
[
|
||||
DateTime.parse(b["created_at"]).in_time_zone,
|
||||
a["name"],
|
||||
b["relationship_type"],
|
||||
a["user_email"]
|
||||
] <=> [
|
||||
DateTime.parse(a["created_at"]).in_time_zone,
|
||||
b["name"],
|
||||
a["relationship_type"],
|
||||
b["user_email"]
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user