プロジェクト

全般

プロフィール

Vote #69952

完了

Can't remove "Project" column on custom query

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

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

100%

予定工数:
category_id:
2
version_id:
38
issue_org_id:
8411
author_id:
19235
assigned_to_id:
0
comments:
20
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
27
ステータス-->[Closed]

説明

If I create a custom query for issues, and remove the "Project" column from display (for example, if I'm using it as a "Group By" instead), it returns as soon as I apply or save the query.

This appears to be because this is considered to be the "default columns" - if you do this with a saved query, after saving the query, the "Default columns" checkbox is ticked when you go back and edit it.

One solution is to add another column, or change the order, but it's not obvious - a couple of users have tried to create the exact same query and got this result.

It appears to affect all versions but I'm running 1.1.2

To reproduce:

Go to "/issues":/issues

Click "Clear" to make sure you're looking at the default view

Click "Options"

Remove the "Project" column from the right-hand box

Click apply - the column is not removed

To work-around:

Repeat steps 1-4, but then move one of the displayed columns up or down before clicking apply.

I couldn't find any similar reports, but I realise that this may be a duplicate. Also, I'm not sure "Issues" is the correct category.


journals

Confirmed.
--------------------------------------------------------------------------------
Doesn't seem to occur anymore, tested on current trunk and on 1.2.0-stable. I presume it's fixed because now filters, sort options and columns are kept in the URL. Anyway I completed the tests in r6099 to be sure it doesn't happen again. Thanks for reporting (and confirming).
--------------------------------------------------------------------------------
Nope, I confirmed I saw it on 1.2 trunk, will test again.
--------------------------------------------------------------------------------
Ok, if you manage to reproduce, can you run the test and tell me if it's relevant ? Maybe it's more complicated...
--------------------------------------------------------------------------------
Just reproduced on demo site which runs on 1.2.0 following the above instructions step by step, did you try with /issues or /projectX/issues ?

Did not take time to run the test, will try to do it tomorrow.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Still not ran the test (will do !) but find the bug at source:trunk/app/models/query.rb#L347 :

<pre><code class="ruby">
# Set column_names to nil if default columns
if names.map(&:to_s) == Setting.issue_list_default_columns
names = nil
end</code>
</pre>

The test is incomplete for @/issues@ if you remove the Project column from the list since :
* the @names@ method argument will match the default column list
* @:column_names@ attribute will be set to nil
* @#has_default_columns?@ will return true
* @#columns@ will return default column list and project column

Will look for a fix later.
--------------------------------------------------------------------------------
Here's a patch.

I didn't test it in all situations, didn't run the test suite neither.

Also, I guess there's room for nicer code in @#default_column@.

--------------------------------------------------------------------------------
E.g., replacing :

<pre><code class="ruby">
column_index = available_columns.index(column)
# Adds the project column by default for cross-project lists
if project.nil? && !project_column_included && column_index > project_column_index
</code></pre>

by :

<pre><code class="ruby">
# Adds the project column by default for cross-project lists
if project.nil? && !project_column_included && available_columns.index(column) > project_column_index
</code></pre>

would perform faster.
--------------------------------------------------------------------------------
Updated patch
--------------------------------------------------------------------------------
And your test pass since the specified columns are ['tracker', 'subject', 'assigned_to'].

It should not pass with @columns = Setting.issue_list_default_columns@ at start of the test.
--------------------------------------------------------------------------------
This patch still has some glitches, will update it later.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Last one, simplier is better. Got some issues with my env, so couldn't run tests :/
--------------------------------------------------------------------------------
Should be fixed with r7538.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Etienne Massip wrote:
> Should be fixed with r7538.

Confirmed!
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

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

  • カテゴリIssues_2 にセット
  • 対象バージョン1.2.2_38 にセット

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

いいね!0
いいね!0