Commit 49cefe11 authored by Robert Speicher's avatar Robert Speicher

Merge branch '219169-iteration-ce-ee-mixup' into 'master'

[RUN AS-IF-FOSS] Fix Iteration FOSS pipeline

Closes #219169

See merge request gitlab-org/gitlab!33112
parents 55c7d620 a6a0a98c
...@@ -28,6 +28,12 @@ class Iteration < ApplicationRecord ...@@ -28,6 +28,12 @@ class Iteration < ApplicationRecord
scope :upcoming, -> { with_state(:upcoming) } scope :upcoming, -> { with_state(:upcoming) }
scope :started, -> { with_state(:started) } scope :started, -> { with_state(:started) }
scope :within_timeframe, -> (start_date, end_date) do
where('start_date is not NULL or due_date is not NULL')
.where('start_date is NULL or start_date <= ?', end_date)
.where('due_date is NULL or due_date >= ?', start_date)
end
state_machine :state_enum, initial: :upcoming do state_machine :state_enum, initial: :upcoming do
event :start do event :start do
transition upcoming: :started transition upcoming: :started
...@@ -75,6 +81,10 @@ class Iteration < ApplicationRecord ...@@ -75,6 +81,10 @@ class Iteration < ApplicationRecord
self.state_enum = STATE_ENUM_MAP[value] self.state_enum = STATE_ENUM_MAP[value]
end end
def resource_parent
group || project
end
private private
def start_or_due_dates_changed? def start_or_due_dates_changed?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment