1module SearchHelper
  • DuplicateMethodCall - calls 'petitions.model' 2 times » reek
  • FeatureEnvy - refers to 'petitions' more than self (maybe move it to another class?) » reek
  • Complexity 4 » saikuro
2  def paginate(petitions)
 
3    options = {
 
4      scope: :"petitions.pagination",
 
5      previous_page: petitions.previous_page,
 
6      next_page: petitions.next_page,
 
7      total_pages: petitions.total_pages,
 
8      previous_link: polymorphic_path(petitions.model, petitions.previous_params),
 
 9      next_link: polymorphic_path(petitions.model, petitions.next_params)
 
10    }
 
 
12    capture do
 
13      concat t(:previous_html, options) unless petitions.first_page?
 
14      concat t(:next_html, options) unless petitions.last_page?
 
15    end
 
16  end
 
  • FeatureEnvy - refers to 'petitions' more than self (maybe move it to another class?) » reek
  • Complexity 2 » saikuro
18  def filtered_petition_count(petitions)
 
19    total_entries = petitions.total_entries
 
20    noun = petitions.search? ? 'result' : 'petition'
 
21    "#{number_with_delimiter(total_entries)} #{noun.pluralize(total_entries)}"
 
22  end
 
  • Complexity 2 » saikuro
24  def petition_result_path(petition, options = {})
 
25    if petition.is_a?(Archived::Petition)
 
26      archived_petition_path(petition, options)
 
27    else
 
28      petition_path(petition, options)
 
29    end
 
30  end
 
31end