Commit 0291473b authored by tiagonbotelho's avatar tiagonbotelho

fixes issues

parent 7530827e
......@@ -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] })
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment