Project

General

Profile

Actions

Defect #43524

open

Incorrect sorting when using "Subproject of" (parent project) as primary sort key in Project List view

Added by ak iwasaki 5 months ago. Updated 1 day ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Projects
Target version:
-
Resolution:
Affected version:

Description

In the Project List view, when "Subproject of" (parent project) field is included as the primary sort key and the other field as a secondary key, the sorting result becomes incorrect.

Cause:

In models/project_query.rb line 42
QueryColumn.new(:parent_id, :sortable => "#{Project.table_name}.lft ASC", :default_order => 'desc', :caption => :field_parent),

However, #{Project.table_name}.lft ASC represents the hierarchical structure itself. Even projects with the same name can have different lft values, and when this is included as a sort key, a secondary sort key does not work correctly.

The following definition appears to be correct:

QueryColumn.new(:parent_id, :sortable => "#{Project.table_name}.parent_id", :default_order => 'desc', :caption => :field_parent),

Files

patch-issue-43524-fix-project-sort-by-parent.diff (2.16 KB) patch-issue-43524-fix-project-sort-by-parent.diff Akihiro Kubota, 2026-05-05 07:14
after_sort_asc.png (235 KB) after_sort_asc.png Akihiro Kubota, 2026-05-05 07:14
before_sort_asc.png (240 KB) before_sort_asc.png Akihiro Kubota, 2026-05-05 07:14
before_sort_desc.png (243 KB) before_sort_desc.png Akihiro Kubota, 2026-05-05 07:14
after_sort_desc.png (243 KB) after_sort_desc.png Akihiro Kubota, 2026-05-05 07:14
patch-issue-43524-fix-project-sort-by-parent-v2.diff (2.77 KB) patch-issue-43524-fix-project-sort-by-parent-v2.diff Akihiro Kubota, 2026-05-05 10:28
Actions

Also available in: Atom PDF