ランク別に並べ替えても期待した値が表示されない

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

症状

When you attempt to sort issues by Rank using the Issue Navigator, the issues do not appear to be sorted numerically. Users sometimes expect that issues will appear ordered by the Rank field, in consecutive order from 1 to the number of ranked issues.

説明

In JIRA Agile 5.8 and later, ranking is based on a custom field called 'Rank' (of type Global Rank). Note that you can have multiple fields of type Global Rank, if you wish. Each Global Rank field is a linked list that contains every issue in JIRA in order (from highest rank to lowest rank). 

The 'value' of a Global Rank field for an issue is not meaningful, though by co-incidence it contains the absolute index inside the linked list of issues in the system.  The user is not meant to view this field (it is not shown on the View Issue screen or the Issue Navigator by default) because the absolute number does not mean anything except when compared to other issues in the search results. For example, the ranks in a system might look like the following: 

ランク課題キー
1HIT-5
2PRO-1
3TST-3
4PRO-2
5TST-1
6PRO-8
7PRO-13

If the user searched inside project PRO and ordered by the rank field they would get the correct order of issues (PRO-1, PRO-2, PRO-8, PRO-13) but would be confused by the numbers (2, 4, 6, 7). The fact that there are gaps is irrelevant because they probably do not care about TST at all. The end summary: 

  • If you query issues with "order by rank asc" you will get the correct order of issues by rank.
  • The numbers shown (ie. the value of the Rank field) will often not be sequential, but their order is correct.
  • The exception to the above is that sub-tasks are ranked independently.
  • If you queried every issue in the system and ordered by Rank, then the rank field would begin at 1 and increase consecutively except for subtasks.

Special Note About Sub-Tasks

While sub-tasks are included in the global rank linked list, they are ranked first by their parent then by their own rank. Thus the logic for comparing two issues during a "sort by rank" is: 

  1. If issue is a parent issue, compare index.
  2. If issue is a subtask,
    1. First compare parent index, return higher (if not subtasks of the same parent).
    2. Then compare subtask index (if the other issue is also a subtask of the same issue).

This means that subtasks are always ranked immediately next to their parent regardless of the absolute ranking index value. As a result, a search of all issues in a system with something like "order by rank asc" would correctly return the ordered list of issues but the rank value would only be consecutive for non sub-tasks (except for gaps where the sub-tasks consume index values).  Here's an example: 

ランク課題キー
1PRO-8
2TST-4
3PRO-4
4PRO-8 / PRO-16
5TST-2
6PRO-8 / PRO-19
7PRO-1
8TST-6
9PRO-1 / PRO-4

If you searched only for project PRO with "order by rank asc" you would get PRO-8, PRO-16, PRO-19, PRO-4, PRO-1, PRO-4. The 'rank' values would be 1, 4, 6, 3, 7, 9.

最終更新日 2013 年 8 月 26 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.