Fix new rubocop warnings

This commit is contained in:
Tom Hughes 2021-11-16 08:30:04 +00:00
parent 7b1e78e247
commit e3966479a6

View file

@ -1,6 +1,8 @@
require "ostruct" require "ostruct"
module ReportsHelper module ReportsHelper
Category = Struct.new(:id, :label)
def report_link(name, reportable) def report_link(name, reportable)
link_to name, new_report_url(:reportable_id => reportable.id, :reportable_type => reportable.class.name) link_to name, new_report_url(:reportable_id => reportable.id, :reportable_type => reportable.class.name)
end end
@ -8,7 +10,7 @@ module ReportsHelper
# Convert a list of strings into objects with methods that the collection_radio_buttons helper expects # Convert a list of strings into objects with methods that the collection_radio_buttons helper expects
def report_categories(reportable) def report_categories(reportable)
Report.categories_for(reportable).map do |c| Report.categories_for(reportable).map do |c|
OpenStruct.new(:id => c, :label => t(".categories.#{reportable.class.name.underscore}.#{c}_label")) Category.new(c, t(".categories.#{reportable.class.name.underscore}.#{c}_label"))
end end
end end
end end