diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/finders/issuable_finder.rb | 4 | ||||
-rw-r--r-- | app/models/milestone.rb | 5 |
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) |