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 21 days ago. Updated 21 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Projects
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
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),
Actions #1

Updated by ak iwasaki 21 days ago

Japanese translation
プロジェクト リストで,"親プロジェクト名"を条件に含む並び替えを行った場合,2つ目以降に指定した条件が無視されて正しくソートされません。

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

の#{Project.table_name}.lftは,それ自体が階層構造持っていて,同じ親プロジェクト名であっても違う値になり,それに基づきソートされるため2つ目以降の条件が意図するソートになりません。

#{Project.table_name}.parent_id が正しい記述と思われます。

Actions

Also available in: Atom PDF