Class: Decidim::Initiatives::OrganizationPrioritizedInitiatives

Inherits:
Query
  • Object
show all
Defined in:
app/queries/decidim/initiatives/organization_prioritized_initiatives.rb

Overview

This query retrieves the organization prioritized initiatives that will appear in the homepage

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(organization, order) ⇒ OrganizationPrioritizedInitiatives

Returns a new instance of OrganizationPrioritizedInitiatives.



9
10
11
12
# File 'app/queries/decidim/initiatives/organization_prioritized_initiatives.rb', line 9

def initialize(organization, order)
  @organization = organization
  @order = order
end

Instance Attribute Details

#orderObject (readonly)

Returns the value of attribute order.



7
8
9
# File 'app/queries/decidim/initiatives/organization_prioritized_initiatives.rb', line 7

def order
  @order
end

#organizationObject (readonly)

Returns the value of attribute organization.



7
8
9
# File 'app/queries/decidim/initiatives/organization_prioritized_initiatives.rb', line 7

def organization
  @organization
end

Instance Method Details

#queryObject



14
15
16
17
18
19
20
# File 'app/queries/decidim/initiatives/organization_prioritized_initiatives.rb', line 14

def query
  if order == "most_recent"
    base_query.order_by_most_recently_published
  else
    base_query
  end
end