2020-04-23 17:09:31 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Sprint < ApplicationRecord
|
2020-04-27 05:09:51 -04:00
|
|
|
STATE_ID_MAP = {
|
|
|
|
active: 1,
|
|
|
|
closed: 2
|
|
|
|
}.with_indifferent_access.freeze
|
|
|
|
|
|
|
|
include AtomicInternalId
|
|
|
|
|
|
|
|
has_many :issues
|
|
|
|
has_many :merge_requests
|
|
|
|
|
2020-04-23 17:09:31 -04:00
|
|
|
belongs_to :project
|
|
|
|
belongs_to :group
|
2020-04-27 05:09:51 -04:00
|
|
|
|
|
|
|
has_internal_id :iid, scope: :project, init: ->(s) { s&.project&.sprints&.maximum(:iid) }
|
|
|
|
has_internal_id :iid, scope: :group, init: ->(s) { s&.group&.sprints&.maximum(:iid) }
|
2020-04-23 17:09:31 -04:00
|
|
|
end
|