Feature #23215

Add the possibility to filter issues after Target Version's Status and Due Date

Added by Marius BALTEANU 10 months ago. Updated 7 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Issues filter
Target version:3.4.0
Resolution:Fixed

Description

Currently, we have the possibility to filter issues only after target version name and target version's custom fields (that have the "Used as a filter" checked).

It'll very helpful to have the possibility to filter after target version status (open/locked/closed) and target version due date (effective_date). With these 2 new filters you can cover most of the use cases related to target version.
Some examples:
- a query that returns all the issues that are assigned in open versions
- a query that returns all the issues that are assigned in versions with due date

The attached patch:
- implements these new 2 filters
- groups the target version status and target version due date with target version's custom fields under the label Target Version . I wasn't sure that is a good idea to move also the existing target version filter (name) to this group. (attached target_version_group.png)
- adds 2 new tests
- breaks an existing tests (QueryTest#test_total_by_project_group_for_spent_hours), but I'm not sure how to fix the problem. The respective test have also a to do comment to remove some code after this issue is fixed (and is was fixed).

I think that this ticket is related to #21249

target_version_group.png (45.9 KB) Marius BALTEANU, 2016-07-01 00:11

filter_after_target_version_status_and_due_date.patch Magnifier (5.51 KB) Marius BALTEANU, 2016-07-01 00:25

filter_after_target_version_status_and_due_date_v2.patch Magnifier (5.32 KB) Marius BALTEANU, 2016-07-05 22:25

filter_after_target_version_status_and_due_date_r15732.patch Magnifier (5.14 KB) Marius BALTEANU, 2016-07-24 23:21

3.4.0_filter_after_target_version_status_and_due_date_r15820.patch Magnifier (5.77 KB) Marius BALTEANU, 2016-09-05 23:23


Related issues

Related to Redmine - Feature #21249: Ability to filter issues by attributes of a version custo... Closed
Duplicated by Redmine - Feature #23855: Target version filter should get an entry 'All open versi... Closed
Duplicated by Redmine - Feature #20197: Filter Issue by attribute of the Version Closed
Duplicated by Redmine - Feature #14164: filter issue list by version status Closed

Associated revisions

Revision 15881
Added by Jean-Philippe Lang 7 months ago

Add the possibility to filter issues after Target Version's Status and Due Date (#23215).

Patch by Marius BALTEANU.

Revision 15882
Added by Jean-Philippe Lang 7 months ago

Translate statuses in the version status filter (#23215).

History

#1 Updated by Toshi MARUYAMA 10 months ago

  • Tracker changed from Defect to Feature

#2 Updated by Jean-Philippe Lang 10 months ago

Thanks for this patch.

breaks an existing tests (QueryTest#test_total_by_project_group_for_spent_hours), but I'm not sure how to fix the problem.

This is caused by a Rails bug that was reported here: https://github.com/rails/rails/issues/21922

The respective test have also a to do comment to remove some code after this issue is fixed (and is was fixed).

This is another issue that will also be fixed in Rails 5.

I'd prefer using a subquery when a filter is applied on version date or status rather that having to do a left join on versions for all queries. Otherwise, we'll have to wait for Rails 5.

#3 Updated by Marius BALTEANU 10 months ago

Jean-Philippe Lang wrote:

I'd prefer using a subquery when a filter is applied on version date or status rather that having to do a left join on versions for all queries. Otherwise, we'll have to wait for Rails 5.

Thanks for your feedback, it is very useful for me. I'll update the patch next week to use subquries.

#4 Updated by Toshi MARUYAMA 10 months ago

  • Related to Feature #21249: Ability to filter issues by attributes of a version custom field (e.g. release date) added

#5 Updated by Marius BALTEANU 10 months ago

I've updated the patch to avoid the left join on versions for all queries. With the current patch, all the tests pass. I chose to retrieve first the version ids and then make an "fixed_version_id IN ()" condition because it doesn't require to write a custom query. @Jean-Philippe Lang, I'm not sure if this solution is better or not than your proposed one.

#6 Updated by Sebastian Paluch 10 months ago

+1

#7 Updated by Marius BALTEANU 9 months ago

I've updated the patch to apply clearly on the current trunk (r15732). Is there anything else I can do in order to have this in 3.4.0? (together with the other changes made on queries).

#8 Updated by Toshi MARUYAMA 9 months ago

  • Target version set to 3.4.0

#9 Updated by Olivier Houdas 8 months ago

We are also interested by this feature in our company, and I tried it on our test server.

It works well, but there is a remark I would like to make:
In most Redmine filters, using the "Is not" operator includes nulls in the results. For example, if you filter for Target version "is not" and select all versions (multi-selection), you will obtain the same result as with the "None" operator (that is, all not planned issues).

I have the feeling that your filters should do the same.
(something, like:
nl = operator == "!" ? "#{Issue.table_name}.fixed_version_id IS NULL OR" : ''
"(#{nl} #{sql_for_field("fixed_version_id", "=", version_ids, Issue.table_name, "fixed_version_id")})"

)

#10 Updated by Marius BALTEANU 8 months ago

Olivier Houdas wrote:

In most Redmine filters, using the "Is not" operator includes nulls in the results. For example, if you filter for Target version "is not" and select all versions (multi-selection), you will obtain the same result as with the "None" operator (that is, all not planned issues).

I'm not sure at which filter do you refer because this patch adds the following two new filters:
  1. Target Version's Status: which has the "Is not" operator but your scenario is not possible because versions with status null cannot exist in Redmine. Each version has a status: open, closed or locked.
  2. Target Version's Due Date: The "Is not" operator isn't available for this filter.

Please let me know if I'm wrong.

#11 Updated by Olivier Houdas 8 months ago

I refer to both filters, as the Target version field can be null for an issue (not set).
Currently,
  1. "Target version "is not" (multiple selection of all versions defined) returns all issues which do not have any target version defined
  2. "Target version status" "is not" "Closed" returns all issues having a target version defined, which have the open or locked status
  3. "Target version due date" "none" returns all issues which have a target version defined, but for which no due date is defined
My understanding of those conditions would return
  1. current behaviour of Redmine, unchanged
  2. all issues with an open or locked target version PLUS all issues which do not have any target version defined
  3. all issues which have a target version defined with no due date PLUS all issues not having any target version defined

I hope my remark is clearer with those two examples.
(edit: corrected my text as I had mixed two examples into one, making no sense, sorry)

#12 Updated by Marius BALTEANU 8 months ago

Olivier Houdas wrote:

I refer to both filters, as the Target version field can be null for an issue (not set).
Currently,
  1. "Target version "is not" (multiple selection of all versions defined) returns all issues which do not have any target version defined
  2. "Target version status" "is not" "Closed" returns all issues having a target version defined, which have the open or locked status
  3. "Target version due date" "none" returns all issues which have a target version defined, but for which no due date is defined
My understanding of those conditions would return
  1. current behaviour of Redmine, unchanged
  2. all issues with an open or locked target version PLUS all issues which do not have any target version defined

I've updated the patch in order to include also the issues without target version when the "Is not" operator is used. Attached 3.4.0_filter_after_target_version_status_and_due_date_r15820.patch

  1. all issues which have a target version defined with no due date PLUS all issues not having any target version defined
Here I wasn't sure what to do because of the following behaviour:
  • add a new custom field for versions ("Start date" for example) having the format set to "date"
  • check "Used as a filter"
  • repeat your test with "none" operator using the filter "Target version's Start date" and observe that the issues without target version are not included.

Maybe your proposal is the expected behaviour and this is a bug in the Redmine core, but I think that is better to wait for a feedback from Redmine contributors regarding this case.

I hope my remark is clearer with those two examples.
(edit: corrected my text as I had mixed two examples into one, making no sense, sorry)

Thanks for your feedback and the detailed explication, now it is clear for me.

Regarding the new patch, I've made some improvements to the tests in order to:
  • check also the issues ids returned by these new queries
  • check the case with "is not" operator.

#13 Updated by Toshi MARUYAMA 7 months ago

  • Related to Feature #23855: Target version filter should get an entry 'All open versions' added

#14 Updated by Jean-Philippe Lang 7 months ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Patch committed in r15881 with a few changes, thanks. Filters are named fixed_version.status and fixed_version.due_date instead.

#15 Updated by Toshi MARUYAMA 7 months ago

  • Related to deleted (Feature #23855: Target version filter should get an entry 'All open versions')

#16 Updated by Toshi MARUYAMA 7 months ago

  • Duplicated by Feature #23855: Target version filter should get an entry 'All open versions' added

#17 Updated by Go MAEDA 5 months ago

  • Duplicated by Feature #20197: Filter Issue by attribute of the Version added

#18 Updated by Go MAEDA 5 months ago

  • Duplicated by Feature #14164: filter issue list by version status added

#19 Updated by Go MAEDA 3 months ago

  • Related to Feature #4891: Add version-date to the "Target version" drop down lists added

#20 Updated by Go MAEDA 3 months ago

  • Related to deleted (Feature #4891: Add version-date to the "Target version" drop down lists)

Also available in: Atom PDF