Class: Decidim::ParticipatoryProcesses::ParticipatoryProcessStatsPresenter

Inherits:
StatsPresenter
  • Object
show all
Includes:
IconHelper
Defined in:
decidim-participatory_processes/app/presenters/decidim/participatory_processes/participatory_process_stats_presenter.rb

Overview

A presenter to render statistics in the homepage.

Instance Method Summary collapse

Methods included from IconHelper

#component_icon, #manifest_icon, #resource_icon

Methods included from LayoutHelper

#_icon_classes, #apple_favicon, #application_path, #extended_navigation_bar, #external_icon, #favicon, #icon, #legacy_favicon, #organization_colors, #role

Methods inherited from StatsPresenter

#comments_stats, #statistics

Instance Method Details

#collectionObject

Public: returns a collection of stats (Hash) for the Process Home.


14
15
16
17
18
19
20
21
22
23
24
25
# File 'decidim-participatory_processes/app/presenters/decidim/participatory_processes/participatory_process_stats_presenter.rb', line 14

def collection
  highlighted_stats = process_participants_stats
  highlighted_stats.concat(process_followers_stats(priority: StatsRegistry::HIGH_PRIORITY))
  highlighted_stats.concat(component_stats(priority: StatsRegistry::HIGH_PRIORITY))
  highlighted_stats.concat(component_stats(priority: StatsRegistry::MEDIUM_PRIORITY))
  highlighted_stats.concat(comments_stats(:participatory_processes))
  highlighted_stats = highlighted_stats.reject(&:empty?)
  highlighted_stats = highlighted_stats.reject { |_stat_manifest, _stat_title, stat_number| stat_number.zero? }
  grouped_highlighted_stats = highlighted_stats.group_by(&:first)

  statistics(grouped_highlighted_stats)
end

#participatory_processObject


9
10
11
# File 'decidim-participatory_processes/app/presenters/decidim/participatory_processes/participatory_process_stats_presenter.rb', line 9

def participatory_process
  __getobj__.fetch(:participatory_process)
end