Class: Timelogs::TimelogsFinder

Inherits:
Object
  • Object
show all
Defined in:
app/finders/timelogs/timelogs_finder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent, params = {}) ⇒ TimelogsFinder

Returns a new instance of TimelogsFinder.



7
8
9
10
# File 'app/finders/timelogs/timelogs_finder.rb', line 7

def initialize(parent, params = {})
  @parent = parent
  @params = params
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



5
6
7
# File 'app/finders/timelogs/timelogs_finder.rb', line 5

def params
  @params
end

#parentObject (readonly)

Returns the value of attribute parent.



5
6
7
# File 'app/finders/timelogs/timelogs_finder.rb', line 5

def parent
  @parent
end

Instance Method Details

#executeObject



12
13
14
15
16
17
18
19
# File 'app/finders/timelogs/timelogs_finder.rb', line 12

def execute
  timelogs = parent&.timelogs || Timelog.all
  timelogs = by_time(timelogs)
  timelogs = by_user(timelogs)
  timelogs = by_group(timelogs)
  timelogs = by_project(timelogs)
  apply_sorting(timelogs)
end