Class: WorkItems::RollupableDates

Inherits:
Object
  • Object
show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/models/work_items/rollupable_dates.rb

Instance Method Summary collapse

Constructor Details

#initialize(source, can_rollup:) ⇒ RollupableDates

Returns a new instance of RollupableDates.



7
8
9
10
# File 'app/models/work_items/rollupable_dates.rb', line 7

def initialize(source, can_rollup:)
  @source = source
  @can_rollup = can_rollup
end

Instance Method Details

#due_dateObject



32
33
34
35
36
# File 'app/models/work_items/rollupable_dates.rb', line 32

def due_date
  return source.due_date_fixed if fixed?

  source.due_date
end

#due_date_fixedObject



38
39
40
# File 'app/models/work_items/rollupable_dates.rb', line 38

def due_date_fixed
  source.due_date_fixed
end

#fixed?Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
18
19
# File 'app/models/work_items/rollupable_dates.rb', line 12

def fixed?
  return true unless @can_rollup
  return true if source.start_date_is_fixed && source.start_date_fixed.present?
  return true if source.due_date_is_fixed && source.due_date_fixed.present?
  return true if source.start_date_is_fixed && source.due_date_is_fixed

  false
end

#start_dateObject



22
23
24
25
26
# File 'app/models/work_items/rollupable_dates.rb', line 22

def start_date
  return source.start_date_fixed if fixed?

  source.start_date
end

#start_date_fixedObject



28
29
30
# File 'app/models/work_items/rollupable_dates.rb', line 28

def start_date_fixed
  source.start_date_fixed
end