Vote #76456
完了Filter issues and time entries by project status
0%
説明
When filtering (issues, spent time, etc) by project, the filter shows a list of all non-archived projects. This list becomes very long (in our case) as the closed projects are accumulating. We don't want to archive these closed projects, as we need occasionally to find data related to them.
It is good to choose whether the filter list includes only active project (default) or all (excluding archived, as it is now).
For example, currently the filter consists of two lists:
- is, is not
- project names
It could be changed to:
- is (active), is, is not
- project names
Or add additional list:
- active, all, closed
- is, is not
- project names
So that if "active" is selected, only active projects are shown in the combo list. "Active" should be used by default (rather than "all") - this way it should cover the most used cases without additional effort.
journals
--------------------------------------------------------------------------------
Attached two patches that add the "Project's status" filter to issues and time entries. Beside the filter itself utility, if we add this feature, will allow us to implement #29449 and also, to discuss (I'll add another ticket) the possibility to hide the issues/time entries from closed projects by default (as the closed projects are hidden by default in Projects page).
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Marius, thank you for writing the patch.
It seems working fine but I came across the following error while running tests after applying
0001-Filter-issues-after-project-status.patch. Could you look into this?
<pre>
Failure:
QueriesHelperTest#test_filters_options_for_select_should_group_associations_filters [/Users/maeda/redmines/redmine-trunk/test/helpers/queries_helper_test.rb:78]:
Expected exactly 2 elements matching "optgroup[label="Project"] > option", found 3..
Expected: 2
Actual: 3
</pre>
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Fixed in the attached patch.
Sorry for not catching this test fail from the beginning.
--------------------------------------------------------------------------------
Committed. Thank you for improving Redmine.
--------------------------------------------------------------------------------
Hi,
I came from #29449 and just applied these patches to my redmine 3.4 instance:
* 0001-Filter-issues-after-project-status.patch
* 0002-Filter-time-entries-after-project-status.patch
* 0003-Filter-our-issues-from-closed-projects-in-the-follow.patch (from #29449)
* use_status_active_constant.diff (from #29449)
Now that issues from closed project are filtered out from my page as I expected.
However, a "translation missing" error now appears in the filter on the query page:
!/attachments/download/21897/Screenshot%20from%202018-11-30%2010-44-08.png!
I find it's because Project::LABEL_BY_STATUS (patch 0001) is not working as expected. (I think I18n is not loaded yet when this hash value gets evaluated)
I can fix this by putting the labels hash into query.rb instead of calling Project::LABEL_BY_STATUS. But is there a way to keep the labels inside the Project model and still be able to use the translations? I'm new to ruby and rails and looking forward to some advice.
<pre>
diff --git a/app/models/query.rb b/app/models/query.rb
index dc84402..218c560 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -573,7 +573,11 @@ class Query < ActiveRecord::Base
# Returns a scope of project statuses that are available as columns or filters
def project_statuses_values
- project_statuses = Project::LABEL_BY_STATUS
+ project_statuses = {
+ 1 => l(:project_status_active),
+ 5 => l(:project_status_closed),
+ 9 => l(:project_status_archived),
+ }
# Remove archived status from filters
project_statuses.delete(9)
project_statuses.stringify_keys.invert.to_a
</pre>
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
related_issues
relates,Closed,29482,Query system for Projects page
relates,New,12066,Don't show issues for closed projects in all issues list
relates,Closed,30718,Translation missing for filter by project status
duplicates,Closed,22107,Add "Project status" to issues list's filters
blocks,Closed,29449,Filter out issues from closed projects in My Page blocks