Class: Decidim::Conferences::ConferenceStatsPresenter

Inherits:
Rectify::Presenter
  • Object
show all
Includes:
IconHelper
Defined in:
decidim-conferences/app/presenters/decidim/conferences/conference_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, #extended_navigation_bar, #external_icon, #favicon, #icon, #organization_colors, #role

Instance Method Details

#highlightedObject

Public: Render a collection of primary stats.


11
12
13
14
15
16
17
18
19
20
# File 'decidim-conferences/app/presenters/decidim/conferences/conference_stats_presenter.rb', line 11

def highlighted
  highlighted_stats = component_stats(priority: StatsRegistry::HIGH_PRIORITY)
  highlighted_stats.concat(component_stats(priority: StatsRegistry::MEDIUM_PRIORITY))
  highlighted_stats = highlighted_stats.reject(&:empty?)
  highlighted_stats = highlighted_stats.reject { |_name, data| data.zero? }

  highlighted_stats.map do |name, data|
    { stat_title: name, stat_number: data }
  end
end