Commit 45e516b8 authored by Felipe Artur's avatar Felipe Artur

Fix bug when ordering by milestone due date and filtering by milestone

parent 3b2223f1
...@@ -44,7 +44,6 @@ module Issuable ...@@ -44,7 +44,6 @@ module Issuable
scope :join_project, -> { joins(:project) } scope :join_project, -> { joins(:project) }
scope :references_project, -> { references(:project) } scope :references_project, -> { references(:project) }
scope :non_archived, -> { join_project.where(projects: { archived: false }) } scope :non_archived, -> { join_project.where(projects: { archived: false }) }
scope :outer_join_milestone, -> { joins("LEFT OUTER JOIN milestones ON milestones.id = #{table_name}.milestone_id") }
delegate :name, delegate :name,
:email, :email,
......
...@@ -185,14 +185,12 @@ describe 'Issues', feature: true do ...@@ -185,14 +185,12 @@ describe 'Issues', feature: true do
visit namespace_project_issues_path(project.namespace, project, sort: sort_value_recently_created) visit namespace_project_issues_path(project.namespace, project, sort: sort_value_recently_created)
expect(first_issue).to include('baz') expect(first_issue).to include('baz')
expect(last_issue).to include('foo')
end end
it 'sorts by oldest' do it 'sorts by oldest' do
visit namespace_project_issues_path(project.namespace, project, sort: sort_value_oldest_created) visit namespace_project_issues_path(project.namespace, project, sort: sort_value_oldest_created)
expect(first_issue).to include('foo') expect(first_issue).to include('foo')
expect(last_issue).to include('baz')
end end
it 'sorts by most recently updated' do it 'sorts by most recently updated' do
......
...@@ -130,7 +130,6 @@ describe Issue, "Issuable" do ...@@ -130,7 +130,6 @@ describe Issue, "Issuable" do
let!(:issue2) { create(:issue, project: project, milestone: late_milestone) } let!(:issue2) { create(:issue, project: project, milestone: late_milestone) }
let!(:issue3) { create(:issue, project: project) } let!(:issue3) { create(:issue, project: project) }
it "sorts desc" do it "sorts desc" do
issues = project.issues.sort('milestone_due_desc') issues = project.issues.sort('milestone_due_desc')
expect(issues).to match_array([issue2, issue1, issue, issue3]) expect(issues).to match_array([issue2, issue1, issue, issue3])
......
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