diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-05 12:09:15 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-05 12:09:15 +0000 |
commit | 20d564f1064622ef0623434372ac3ceb03173331 (patch) | |
tree | 000d95440566cd189ea774168c9756bcc8fc5fae /app/models/milestone.rb | |
parent | 26384c9a61da9922b8fa4b8351d4e42d51661b37 (diff) | |
download | gitlab-ce-20d564f1064622ef0623434372ac3ceb03173331.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/milestone.rb')
-rw-r--r-- | app/models/milestone.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/milestone.rb b/app/models/milestone.rb index f709e518047..b3278f48aa9 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -59,6 +59,12 @@ class Milestone < ApplicationRecord where(project_id: projects).or(where(group_id: groups)) end + 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 + scope :order_by_name_asc, -> { order(Arel::Nodes::Ascending.new(arel_table[:title].lower)) } scope :reorder_by_due_date_asc, -> { reorder(Gitlab::Database.nulls_last_order('due_date', 'ASC')) } |