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-18 20:17:01 +0300
committerRobert Speicher <rspeicher@gmail.com>2016-04-20 22:42:09 +0300
commit61a306aa58f7fffd652a31b85719b19d08f0fd7f (patch)
treed937ae097121109cc05070bde406ae7dc18416aa /app/finders/issuable_finder.rb
parent83bda94ffcfe1944ea255fdbb8dfd9dac5b97d9f (diff)
Fix functionality of due this week. Add due this month and overdue, remove due tomorrow to issues.
Fix typos on sorting dropdown related to due date Remove constant array and add Structs on Issue to keep due date data to fill options
Diffstat (limited to 'app/finders/issuable_finder.rb')
-rw-r--r--app/finders/issuable_finder.rb26
1 files changed, 20 insertions, 6 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb
index 5e08193b5cf..7613283443a 100644
--- a/app/finders/issuable_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -118,7 +118,19 @@ class IssuableFinder
end
def filter_by_no_due_date?
- due_date? && params[:due_date] == Issue::NO_DUE_DATE[1]
+ due_date? && params[:due_date] == Issue::NoDueDate.name
+ end
+
+ def filter_by_overdue?
+ due_date? && params[:due_date] == Issue::OverDue.name
+ end
+
+ def filter_by_due_this_week?
+ due_date? && params[:due_date] == Issue::DueThisWeek.name
+ end
+
+ def filter_by_due_this_month?
+ due_date? && params[:due_date] == Issue::DueThisMonth.name
end
def labels?
@@ -295,11 +307,13 @@ class IssuableFinder
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])
+ items = items.without_due_date
+ elsif filter_by_overdue?
+ items = items.overdue
+ elsif filter_by_due_this_week?
+ items = items.due_between(Date.today.beginning_of_week, Date.today.end_of_week + 1.day)
+ elsif filter_by_due_this_month?
+ items = items.due_between(Date.today.beginning_of_month, Date.today.end_of_month + 1.day)
end
end
items