Project

General

Profile

Actions

Feature #20081

closed

Filter issues and time entries by project status

Added by Zer Guz over 9 years ago. Updated about 6 years ago.

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

0%

Estimated time:
Resolution:
Fixed

Description

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.


Files


Related issues

Related to Redmine - Feature #29482: Query system for Projects pageClosedJean-Philippe Lang

Actions
Related to Redmine - Feature #12066: Don't show issues for closed projects in all issues listNew

Actions
Related to Redmine - Defect #30718: Translation missing for filter by project statusClosedGo MAEDA

Actions
Has duplicate Redmine - Feature #22107: Add "Project status" to issues list's filtersClosed

Actions
Blocks Redmine - Feature #29449: Filter out issues from closed projects in My Page blocksClosedGo MAEDA

Actions
Actions #1

Updated by Go MAEDA almost 8 years ago

  • Has duplicate Feature #22107: Add "Project status" to issues list's filters added
Actions #2

Updated by Marius BĂLTEANU about 6 years ago

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).

Actions #3

Updated by Marius BĂLTEANU about 6 years ago

Actions #4

Updated by Marius BĂLTEANU about 6 years ago

  • Related to Feature #29449: Filter out issues from closed projects in My Page blocks added
Actions #5

Updated by Marius BĂLTEANU about 6 years ago

  • Related to deleted (Feature #29449: Filter out issues from closed projects in My Page blocks)
Actions #6

Updated by Marius BĂLTEANU about 6 years ago

  • Blocks Feature #29449: Filter out issues from closed projects in My Page blocks added
Actions #7

Updated by Marius BĂLTEANU about 6 years ago

  • Related to Feature #12066: Don't show issues for closed projects in all issues list added
Actions #8

Updated by Go MAEDA about 6 years ago

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?

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
Actions #9

Updated by Marius BĂLTEANU about 6 years ago

  • File deleted (0001-Filter-issues-after-project-status.patch)
Actions #10

Updated by Marius BĂLTEANU about 6 years ago

Fixed in the attached patch.

Sorry for not catching this test fail from the beginning.

Actions #11

Updated by Go MAEDA about 6 years ago

  • Subject changed from Show only active projects in the filter to Filter issues and time entries by project status
  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Target version set to 4.0.0
  • Resolution set to Fixed

Committed. Thank you for improving Redmine.

Actions #12

Updated by Rang Tang about 6 years ago

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:

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.

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
Actions #13

Updated by Marius BĂLTEANU almost 6 years ago

  • Related to Defect #30718: Translation missing for filter by project status added
Actions

Also available in: Atom PDF