Class: Iteration

Inherits:
ApplicationRecord show all
Includes:
AtomicInternalId
Defined in:
app/models/iteration.rb

Constant Summary collapse

STATE_ENUM_MAP =
{
    upcoming: 1,
    started: 2,
    closed: 3
}.with_indifferent_access.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AtomicInternalId

#internal_id_read_scope, #internal_id_scope_attrs, #internal_id_scope_usage

Methods inherited from ApplicationRecord

at_most, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, underscore, without_order

Instance Attribute Details

#skip_future_date_validationObject

Returns the value of attribute skip_future_date_validation


6
7
8
# File 'app/models/iteration.rb', line 6

def skip_future_date_validation
  @skip_future_date_validation
end

#skip_project_validationObject

Returns the value of attribute skip_project_validation


7
8
9
# File 'app/models/iteration.rb', line 7

def skip_project_validation
  @skip_project_validation
end

Class Method Details

.filter_by_state(iterations, state) ⇒ Object


62
63
64
65
66
67
68
69
70
# File 'app/models/iteration.rb', line 62

def filter_by_state(iterations, state)
  case state
  when 'closed' then iterations.closed
  when 'started' then iterations.started
  when 'opened' then iterations.started.or(iterations.upcoming)
  when 'all' then iterations
  else iterations.upcoming
  end
end

.reference_patternObject


76
77
78
# File 'app/models/iteration.rb', line 76

def reference_pattern
  nil
end

.reference_prefixObject


72
73
74
# File 'app/models/iteration.rb', line 72

def reference_prefix
  '*iteration:'
end

Instance Method Details

#resource_parentObject


89
90
91
# File 'app/models/iteration.rb', line 89

def resource_parent
  group || project
end

#stateObject


81
82
83
# File 'app/models/iteration.rb', line 81

def state
  STATE_ENUM_MAP.key(state_enum)
end

#state=(value) ⇒ Object


85
86
87
# File 'app/models/iteration.rb', line 85

def state=(value)
  self.state_enum = STATE_ENUM_MAP[value]
end