diff options
author | Sean McGivern <sean@gitlab.com> | 2019-03-11 17:15:05 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-03-19 17:28:30 +0300 |
commit | 222199f67032306aa318cab3f09f4be1d5c7e731 (patch) | |
tree | 3917231bda5da39507db995eb6ff5075db641f9f /app | |
parent | 8d067414f5112be1a8e927ba06fad0abc989038f (diff) |
Only count active milestones as started
The Upcoming milestone filter only considers active milestones, but the
Started one included closed milestones, too. This was inconsistent.
Diffstat (limited to 'app')
-rw-r--r-- | app/finders/issuable_finder.rb | 2 | ||||
-rw-r--r-- | app/models/milestone.rb | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index 072d07e0ed2..6eab8c5ee51 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -496,7 +496,7 @@ class IssuableFinder upcoming_ids = Milestone.upcoming_ids(projects, related_groups) items = items.left_joins_milestones.where(milestone_id: upcoming_ids) elsif filter_by_started_milestone? - items = items.left_joins_milestones.where('milestones.start_date <= NOW()') + items = items.left_joins_milestones.merge(Milestone.started) else items = items.with_milestone(params[:milestone_title]) end diff --git a/app/models/milestone.rb b/app/models/milestone.rb index d6f94cad1fb..a3831ae3fa8 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -37,6 +37,7 @@ class Milestone < ActiveRecord::Base scope :active, -> { with_state(:active) } scope :closed, -> { with_state(:closed) } scope :for_projects, -> { where(group: nil).includes(:project) } + scope :started, -> { active.where('milestones.start_date <= CURRENT_DATE') } scope :for_projects_and_groups, -> (projects, groups) do projects = projects.compact if projects.is_a? Array |