Class: MilestonesFinder
- Inherits:
-
Object
- Object
- MilestonesFinder
- Includes:
- FinderMethods, TimeFrameFilter, UpdatedAtFilter
- Defined in:
- app/finders/milestones_finder.rb
Overview
Search for milestones
params - Hash
ids - filters by id.
project_ids: Array of project ids or single project id or ActiveRecord relation.
group_ids: Array of group ids or single group id or ActiveRecord relation.
order - Orders by field default due date asc.
title - filter by title.
state - filters by state.
start_date & end_date - filters by timeframe (see TimeFrameFilter)
containing_date - filters by point in time (see TimeFrameFilter)
Constant Summary collapse
- EXPIRED_LAST_SORTS =
%i[expired_last_due_date_asc expired_last_due_date_desc].freeze
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(params = {}) ⇒ MilestonesFinder
constructor
A new instance of MilestonesFinder.
Methods included from UpdatedAtFilter
Methods included from TimeFrameFilter
#by_timeframe, #containing_date
Methods included from FinderMethods
Constructor Details
#initialize(params = {}) ⇒ MilestonesFinder
Returns a new instance of MilestonesFinder.
24 25 26 |
# File 'app/finders/milestones_finder.rb', line 24 def initialize(params = {}) @params = params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
20 21 22 |
# File 'app/finders/milestones_finder.rb', line 20 def params @params end |
Instance Method Details
#execute ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/finders/milestones_finder.rb', line 28 def execute items = Milestone.all items = by_ids(items) items = by_groups_and_projects(items) items = by_title(items) items = by_search_title(items) items = by_search(items) items = by_state(items) items = by_timeframe(items) items = containing_date(items) items = by_updated_at(items) items = by_iids(items) order(items) end |