Class: Decidim::Conferences::ConferenceStatsPresenter

Inherits:
StatsPresenter
  • Object
show all
Includes:
IconHelper
Defined in:
app/presenters/decidim/conferences/conference_stats_presenter.rb

Overview

A presenter to render statistics in the homepage.

Instance Method Summary collapse

Instance Method Details

#conferenceObject



9
10
11
# File 'app/presenters/decidim/conferences/conference_stats_presenter.rb', line 9

def conference
  __getobj__.fetch(:conference)
end

#highlightedObject

Public: Render a collection of primary stats.



14
15
16
17
18
19
20
21
22
23
# File 'app/presenters/decidim/conferences/conference_stats_presenter.rb', line 14

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

  statistics(grouped_highlighted_stats)
end