Updated

app/helpers / search_helper.rb

A
31 lines of codes
3 methods
9.1 complexity/method
13 churn
27.21 complexity
0 duplications
module SearchHelper
  1. SearchHelper has no descriptive comment
def paginate(petitions) options = { scope: :"petitions.pagination", previous_page: petitions.previous_page,
  1. SearchHelper#paginate refers to 'petitions' more than self (maybe move it to another class?) Locations: 0 1 2 3 4 5 6
next_page: petitions.next_page,
  1. SearchHelper#paginate refers to 'petitions' more than self (maybe move it to another class?) Locations: 0 1 2 3 4 5 6
total_pages: petitions.total_pages,
  1. SearchHelper#paginate refers to 'petitions' more than self (maybe move it to another class?) Locations: 0 1 2 3 4 5 6
previous_link: polymorphic_path(petitions.model, petitions.previous_params),
  1. SearchHelper#paginate calls 'petitions.model' 2 times Locations: 0 1
  2. SearchHelper#paginate refers to 'petitions' more than self (maybe move it to another class?) Locations: 0 1 2 3 4 5 6
next_link: polymorphic_path(petitions.model, petitions.next_params)
  1. SearchHelper#paginate calls 'petitions.model' 2 times Locations: 0 1
  2. SearchHelper#paginate refers to 'petitions' more than self (maybe move it to another class?) Locations: 0 1 2 3 4 5 6
} capture do concat t(:previous_html, options) unless petitions.first_page?
  1. SearchHelper#paginate refers to 'petitions' more than self (maybe move it to another class?) Locations: 0 1 2 3 4 5 6
concat t(:next_html, options) unless petitions.last_page?
  1. SearchHelper#paginate refers to 'petitions' more than self (maybe move it to another class?) Locations: 0 1 2 3 4 5 6
end end def filtered_petition_count(petitions) total_entries = petitions.total_entries
  1. SearchHelper#filtered_petition_count refers to 'petitions' more than self (maybe move it to another class?) Locations: 0 1
noun = petitions.search? ? 'result' : 'petition'
  1. SearchHelper#filtered_petition_count refers to 'petitions' more than self (maybe move it to another class?) Locations: 0 1
"#{number_with_delimiter(total_entries)} #{noun.pluralize(total_entries)}" end def petition_result_path(petition, options = {}) if petition.is_a?(Archived::Petition) archived_petition_path(petition, options) else petition_path(petition, options) end end end