OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#62982] when ordering by phase, treat no phase as -1
Tobias Dillmann6416128b33d2
diff --git a/app/models/queries/work_packages/selects/project_phase_select.rb b/app/models/queries/work_packages/selects/project_phase_select.rbindex 84ff7e378b4..fe6a6e431bb 100644--- a/app/models/queries/work_packages/selects/project_phase_select.rb+++ b/app/models/queries/work_packages/selects/project_phase_select.rb@@ -85,7 +85,7 @@ class Queries::WorkPackages::Selects::ProjectPhaseSelect < Queries::WorkPackages# We use the join alias from the group by join statement to ensure that work packages with an *inactive* project# phase are treated like work packages *without* a project phase. In the result list, they will belong to the# same group: without an active project phase.- "pd.position"+ "COALESCE(pd.position, -1)"enddef self.instances(context = nil)diff --git a/spec/features/work_packages/table/project_phase_field_spec.rb b/spec/features/work_packages/table/project_phase_field_spec.rbindex 8a556afad58..fcc2d45da2d 100644--- a/spec/features/work_packages/table/project_phase_field_spec.rb+++ b/spec/features/work_packages/table/project_phase_field_spec.rb@@ -96,7 +96,7 @@ RSpec.describe "Project phase field in the work package table", :js dolet(:sort_criteria) { [%w[project_phase asc]] }it "sorts ASC by phase position" do- wp_table.expect_work_package_order(other_wp, work_package, wp_without_phase)+ wp_table.expect_work_package_order(wp_without_phase, other_wp, work_package)endend@@ -104,7 +104,7 @@ RSpec.describe "Project phase field in the work package table", :js dolet(:sort_criteria) { [%w[project_phase desc]] }it "sorts DESC by phase position" do- wp_table.expect_work_package_order(wp_without_phase, work_package, other_wp)+ wp_table.expect_work_package_order(work_package, other_wp, wp_without_phase)endend@@ -127,11 +127,11 @@ RSpec.describe "Project phase field in the work package table", :js doendit "includes the group icon in the group row header" do- within("#wp-table-rowgroup-0") do+ within("#wp-table-rowgroup-1") doexpect(page).to have_test_selector("project-phase-icon #{other_project_phase.name}")end- within("#wp-table-rowgroup-1") do+ within("#wp-table-rowgroup-2") doexpect(page).to have_test_selector("project-phase-icon #{project_phase.name}")endend@@ -147,10 +147,18 @@ RSpec.describe "Project phase field in the work package table", :js dowp_table.expect_work_package_with_attributes(wp_without_phase, { projectPhase: "-" })end+ context "when sorting by project phase ASC" do+ let(:sort_criteria) { [%w[project_phase asc]] }++ it "sorts work packages with an inactive project phase like work packages without a project phase" do+ wp_table.expect_work_package_order(wp_without_phase, other_wp, work_package)+ end+ end+context "when grouping" dolet(:group_by) { :project_phase }- it "treats work packages with an inactive project phase like work packages without a project phase" do+ it "groups work packages with an inactive project phase like work packages without a project phase" dowp_table.expect_groups({project_phase.name => 1,"-" => 2