Class: Decidim::ParticipatoryProcesses::StatsFollowersCount

Inherits:
Query
  • Object
show all
Defined in:
app/queries/decidim/participatory_processes/stats_followers_count.rb

Overview

This class counts all Followers of a participatory process or participatory processes belonging to a participatory process group

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(participatory_space) ⇒ StatsFollowersCount

Returns a new instance of StatsFollowersCount.



15
16
17
# File 'app/queries/decidim/participatory_processes/stats_followers_count.rb', line 15

def initialize(participatory_space)
  @participatory_space = participatory_space
end

Class Method Details

.for(participatory_space) ⇒ Object



8
9
10
11
12
13
# File 'app/queries/decidim/participatory_processes/stats_followers_count.rb', line 8

def self.for(participatory_space)
  return 0 unless participatory_space.is_a?(Decidim::ParticipatoryProcess) ||
                  (participatory_space.is_a?(Decidim::ParticipatoryProcessGroup) && participatory_space.participatory_processes.exists?)

  new(participatory_space).query
end

Instance Method Details

#queryObject



19
20
21
# File 'app/queries/decidim/participatory_processes/stats_followers_count.rb', line 19

def query
  space_query + components_query
end