summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortiagonbotelho <tiagonbotelho@hotmail.com>2016-03-12 16:54:05 +0000
committertiagonbotelho <tiagonbotelho@hotmail.com>2016-03-12 18:08:01 +0000
commit0291473b98b457e85657aac29520b5f2b5b631ec (patch)
tree9cfea5c4cb6d439260841781e3afa00fe3ca14c8
parent7530827ecae0596616623d1c4f7775b08d5ada3c (diff)
downloadgitlab-ce-0291473b98b457e85657aac29520b5f2b5b631ec.tar.gz
fixes issues
-rw-r--r--app/finders/issuable_finder.rb4
-rw-r--r--app/models/milestone.rb5
2 files changed, 4 insertions, 5 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb
index d592bdd0eb5..5e22aca45f7 100644
--- a/app/finders/issuable_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -245,7 +245,7 @@ class IssuableFinder
end
def upcoming?
- params[:milestone_title] == '#upcoming' && projects
+ params[:milestone_title] == '#upcoming'
end
def by_milestone(items)
@@ -253,7 +253,7 @@ class IssuableFinder
if filter_by_no_milestone?
items = items.where(milestone_id: [-1, nil])
elsif upcoming?
- upcoming = Milestone.upcoming(projects)
+ upcoming = Milestone.where(project_id: projects).upcoming
items = items.joins(:milestone).where(milestones: { title: upcoming.title })
else
items = items.joins(:milestone).where(milestones: { title: params[:milestone_title] })
diff --git a/app/models/milestone.rb b/app/models/milestone.rb
index 7697072d231..374590ba0c5 100644
--- a/app/models/milestone.rb
+++ b/app/models/milestone.rb
@@ -82,9 +82,8 @@ class Milestone < ActiveRecord::Base
super("milestones", /(?<milestone>\d+)/)
end
- def self.upcoming(projects)
- self.where(project_id: projects)
- .where('due_date > ?', Time.now). order(due_date: :asc).first
+ def self.upcoming
+ self.where('due_date > ?', Time.now).order(due_date: :asc).first
end
def to_reference(from_project = nil)