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:
authorMehmet Beydogan <mehmet.beydogan@gmail.com>2016-03-10 17:26:56 +0300
committerRobert Speicher <rspeicher@gmail.com>2016-04-20 22:42:09 +0300
commit3afd08170da6f003b4f11ae1a3f737b14dedec40 (patch)
tree0e858cd1c275f7862743022e4c2b24bfef3b2148 /app/finders
parent1e596fef1c42a1dd925636c48fea01be444dc3ab (diff)
Add due_date:time field to Issue model
Add due_date text field to sidebar issue#show Add ability sorting issues by due date ASC and DESC Add ability to filtering issues by No Due Date, Any Due Date, Due to tomorrow, Due in this week options Add handling issue due_date field for MergeRequest Update CHANGELOG Fix ambigous match for issues#show sidebar Fix SCREAMING_SNAKE_CASE offenses for due date contants Add specs for due date sorting and filtering on issues
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/issuable_finder.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb
index 5eb1d3f5aac..5e08193b5cf 100644
--- a/app/finders/issuable_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -39,6 +39,7 @@ class IssuableFinder
items = by_assignee(items)
items = by_author(items)
items = by_label(items)
+ items = by_due_date(items)
sort(items)
end
@@ -112,6 +113,14 @@ class IssuableFinder
end
end
+ def due_date?
+ params[:due_date].present?
+ end
+
+ def filter_by_no_due_date?
+ due_date? && params[:due_date] == Issue::NO_DUE_DATE[1]
+ end
+
def labels?
params[:label_name].present?
end
@@ -283,6 +292,19 @@ class IssuableFinder
items.distinct
end
+ def by_due_date(items)
+ if due_date?
+ if filter_by_no_due_date?
+ items = items.no_due_date
+ else
+ items = items.has_due_date
+ # Must use issues prefix to avoid ambiguous match with Milestone#due_date
+ items = items.where("issues.due_date > ? AND issues.due_date <= ?", Date.today, params[:due_date])
+ end
+ end
+ items
+ end
+
def label_names
params[:label_name].split(',')
end