Project

General

Profile

Actions

Feature #23215

closed

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

Added by Marius BĂLTEANU over 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Category:
Issues filter
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
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


Files


Related issues

Related to Redmine - Feature #21249: Ability to filter issues by attributes of a version custom field (e.g. release date)ClosedJean-Philippe Lang

Actions
Related to Redmine - Defect #30924: Filter on Target version's Status in subproject doesn't work on version from top projectClosedMarius BĂLTEANU

Actions
Related to Redmine - Patch #36824: Allow to filter issues by its version status with shared versionsClosedMarius BĂLTEANU

Actions
Has duplicate Redmine - Feature #23855: Target version filter should get an entry 'All open versions'Closed

Actions
Has duplicate Redmine - Feature #20197: Filter Issue by attribute of the VersionClosed

Actions
Has duplicate Redmine - Feature #14164: filter issue list by version statusClosed

Actions
Actions #1

Updated by Toshi MARUYAMA over 8 years ago

  • Tracker changed from Defect to Feature
Actions #2

Updated by Jean-Philippe Lang over 8 years 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.

Actions #3

Updated by Marius BĂLTEANU over 8 years 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.

Actions #4

Updated by Toshi MARUYAMA over 8 years ago

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

Updated by Marius BĂLTEANU over 8 years 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.

Actions #6

Updated by Sebastian Paluch over 8 years ago

+1

Actions #7

Updated by Marius BĂLTEANU over 8 years 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).

Actions #8

Updated by Toshi MARUYAMA over 8 years ago

  • Target version set to 3.4.0
Actions #9

Updated by Olivier Houdas about 8 years 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")})"

)

Actions #10

Updated by Marius BĂLTEANU about 8 years 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.

Actions #11

Updated by Olivier Houdas about 8 years 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)

Actions #12

Updated by Marius BĂLTEANU about 8 years 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.
Actions #13

Updated by Toshi MARUYAMA about 8 years ago

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

Updated by Jean-Philippe Lang about 8 years 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.

Actions #15

Updated by Toshi MARUYAMA about 8 years ago

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

Updated by Toshi MARUYAMA about 8 years ago

  • Has duplicate Feature #23855: Target version filter should get an entry 'All open versions' added
Actions #17

Updated by Go MAEDA almost 8 years ago

  • Has duplicate Feature #20197: Filter Issue by attribute of the Version added
Actions #18

Updated by Go MAEDA almost 8 years ago

  • Has duplicate Feature #14164: filter issue list by version status added
Actions #19

Updated by Go MAEDA almost 8 years ago

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

Updated by Go MAEDA almost 8 years ago

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

Updated by Go MAEDA over 3 years ago

  • Related to Defect #30924: Filter on Target version's Status in subproject doesn't work on version from top project added
Actions #22

Updated by Holger Just over 2 years ago

  • Related to Patch #36824: Allow to filter issues by its version status with shared versions added
Actions

Also available in: Atom PDF