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:
authortiagonbotelho <tiagonbotelho@hotmail.com>2016-03-10 04:49:13 +0300
committertiagonbotelho <tiagonbotelho@hotmail.com>2016-03-12 21:08:01 +0300
commitb9d13c11dee8f555b0d80fd5b9b6a42be7721461 (patch)
treefbf710243c4a55fbf7198a4ec564eed5ac9d0fb3 /app/finders/issuable_finder.rb
parent5a586f364c5d2b866d6a074eff7996f05585b7d5 (diff)
implements upcoming filter in milstones
Diffstat (limited to 'app/finders/issuable_finder.rb')
-rw-r--r--app/finders/issuable_finder.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb
index c88a420b412..410e6f6456c 100644
--- a/app/finders/issuable_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -94,6 +94,10 @@ class IssuableFinder
params[:milestone_title].present?
end
+ def upcoming?
+ params[:milestone_title] == 'Upcoming'
+ end
+
def filter_by_no_milestone?
milestones? && params[:milestone_title] == Milestone::None.title
end
@@ -248,6 +252,10 @@ class IssuableFinder
if milestones?
if filter_by_no_milestone?
items = items.where(milestone_id: [-1, nil])
+ elsif upcoming?
+ upcoming = Milestone.where(project_id: projects)
+ .where('due_date > ?', Time.now).order(due_date: :asc).first
+ items = items.joins(:milestone).where(milestone: { title: upcoming.title })
else
items = items.joins(:milestone).where(milestones: { title: params[:milestone_title] })