diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-27 03:08:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-27 03:08:11 +0300 |
commit | a78d7d5c667a0844e52419f11cb83a9ac60ee6d2 (patch) | |
tree | e317ab1400f6c7e836f8d08d4deea205ad343c39 /app/models/iteration.rb | |
parent | ea335f33ff8c6870e641385a254c1f993bb04038 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/iteration.rb')
-rw-r--r-- | app/models/iteration.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/iteration.rb b/app/models/iteration.rb index 0f993a10542..2bda0725471 100644 --- a/app/models/iteration.rb +++ b/app/models/iteration.rb @@ -28,6 +28,12 @@ class Iteration < ApplicationRecord scope :upcoming, -> { with_state(:upcoming) } 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 event :start do transition upcoming: :started @@ -75,6 +81,10 @@ class Iteration < ApplicationRecord self.state_enum = STATE_ENUM_MAP[value] end + def resource_parent + group || project + end + private def start_or_due_dates_changed? |