Class: Decidim::Admin::UserGroupsEvaluation

Inherits:
Rectify::Query
  • Object
show all
Defined in:
decidim-admin/app/queries/decidim/admin/user_groups_evaluation.rb

Overview

A class used to find the UserGroup's by their evaluation state.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user_groups, query = nil, state = nil) ⇒ UserGroupsEvaluation

Initializes the class.

user_groups - the User groups that need to be filtered query - query to filter user group names state - evaluation state to be used as a filter


21
22
23
24
25
# File 'decidim-admin/app/queries/decidim/admin/user_groups_evaluation.rb', line 21

def initialize(user_groups, query = nil, state = nil)
  @user_groups = user_groups
  @query = query
  @state = state
end

Class Method Details

.for(user_groups, query = nil, state = nil) ⇒ Object

Syntactic sugar to initialize the class and return the queried objects.

user_groups - the initial User Group relation that needs to be filtered. query - query to filter user group names state - evaluation state to be used as a filter


12
13
14
# File 'decidim-admin/app/queries/decidim/admin/user_groups_evaluation.rb', line 12

def self.for(user_groups, query = nil, state = nil)
  new(user_groups, query, state).query
end

Instance Method Details

#queryObject

List the User groups by the diferent filters.


28
29
30
31
32
# File 'decidim-admin/app/queries/decidim/admin/user_groups_evaluation.rb', line 28

def query
  @user_groups = filter_by_search(@user_groups)
  @user_groups = filter_by_state(@user_groups)
  @user_groups
end