Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-04-20 15:41:50 +0300
committerRobert Speicher <rspeicher@gmail.com>2016-04-20 22:43:32 +0300
commit3a7290f387ad6d568ddc5b102218c719dd42ed5d (patch)
treee1dda6b94476a9d69f024377cbb6ebbf42c548d3 /app/models/issue.rb
parentda2e31549c256071d2488db1b4641bf1dda19afe (diff)
Move Issue scopes from Issuable to Issue model
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r--app/models/issue.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 9a382fcda8d..ea1bfb776ee 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -46,6 +46,10 @@ class Issue < ActiveRecord::Base
scope :open_for, ->(user) { opened.assigned_to(user) }
scope :in_projects, ->(project_ids) { where(project_id: project_ids) }
+ scope :without_due_date, -> { where(due_date: nil) }
+ scope :due_before, ->(date) { where('issues.due_date < ?', date) }
+ scope :due_between, ->(from_date, to_date) { where('issues.due_date >= ?', from_date).where('issues.due_date <= ?', to_date) }
+
scope :order_due_date_asc, -> { reorder('issues.due_date IS NULL, issues.due_date ASC') }
scope :order_due_date_desc, -> { reorder('issues.due_date IS NULL, issues.due_date DESC') }