diff options
author | Mehmet Beydogan <mehmet.beydogan@gmail.com> | 2016-03-10 16:26:56 +0200 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-04-20 15:42:09 -0400 |
commit | 3afd08170da6f003b4f11ae1a3f737b14dedec40 (patch) | |
tree | 0e858cd1c275f7862743022e4c2b24bfef3b2148 /app/finders | |
parent | 1e596fef1c42a1dd925636c48fea01be444dc3ab (diff) | |
download | gitlab-ce-3afd08170da6f003b4f11ae1a3f737b14dedec40.tar.gz |
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.rb | 22 |
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 |