プロジェクト

全般

プロフィール

Vote #79535

完了

Redmine::SortCriteria#normalize! does not limit properly the number of elements

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Code cleanup/refactoring_30
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
30
version_id:
99
issue_org_id:
29632
author_id:
259873
assigned_to_id:
332
comments:
4
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

Only three sorting criteria can be selected on the query edit screen.
With code before r16390, only three items could be saved as data according to screen specifications.
!{width: 50%; border: 1px solid #ccc}edit_query.png!

However, since "slice(0,3)" was changed to "slice!(3)" at r16390, the following result is returned now.


# slice(0,3)
sort_criteria = [['priority', 'desc'], ['tracker', 'asc'], ['priority', 'asc'], ['id', 'asc'], ['project', 'asc'], ['subject', 'asc']]
p sort_criteria.slice(0,3)
=> [['priority', 'desc'], ['tracker', 'asc'], ['priority', 'asc']]

# slice!(3)
# The number limit is not made
sort_criteria .slice!(3)
p sort_criteria 
=> [['priority', 'desc'], ['tracker', 'asc'], ['priority', 'asc'], ['subject', 'asc']]

I think it should be restricted to only three from the beginning like the case of "slice(0, 3)".
The attached file is a patch for fix.


journals

--------------------------------------------------------------------------------
I have confirmed the problem and set the target version to 4.1.0.

source:tags/3.4.6/lib/redmine/sort_criteria.rb#L91 removes only the third element, but @normalize!@ method is expected to keep the first three elements and remove the rest.
--------------------------------------------------------------------------------
Committed. Thank you for reporting and fixing the issue.
--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリCode cleanup/refactoring_30 にセット
  • 対象バージョン4.0.0_99 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0