Feature #23215
closedAdd the possibility to filter issues after Target Version's Status and Due Date
0%
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
Updated by Toshi MARUYAMA over 8 years ago
- Tracker changed from Defect to Feature
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.
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.
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
Updated by Marius BĂLTEANU over 8 years ago
- File filter_after_target_version_status_and_due_date_v2.patch filter_after_target_version_status_and_due_date_v2.patch added
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.
Updated by Marius BĂLTEANU over 8 years ago
- File filter_after_target_version_status_and_due_date_r15732.patch filter_after_target_version_status_and_due_date_r15732.patch added
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).
Updated by Olivier Houdas over 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")})"
)
Updated by Marius BĂLTEANU over 8 years ago
Olivier Houdas wrote:
I'm not sure at which filter do you refer because this patch adds the following two new filters: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).
- 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.
- Target Version's Due Date: The "Is not" operator isn't available for this filter.
Please let me know if I'm wrong.
Updated by Olivier Houdas over 8 years ago
Currently,
- "Target version "is not" (multiple selection of all versions defined) returns all issues which do not have any target version defined
- "Target version status" "is not" "Closed" returns all issues having a target version defined, which have the open or locked status
- "Target version due date" "none" returns all issues which have a target version defined, but for which no due date is defined
- current behaviour of Redmine, unchanged
- all issues with an open or locked target version PLUS all issues which do not have any target version defined
- 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)
Updated by Marius BĂLTEANU over 8 years ago
- File 3.4.0_filter_after_target_version_status_and_due_date_r15820.patch 3.4.0_filter_after_target_version_status_and_due_date_r15820.patch added
Olivier Houdas wrote:
I refer to both filters, as the Target version field can be null for an issue (not set).
Currently,My understanding of those conditions would return
- "Target version "is not" (multiple selection of all versions defined) returns all issues which do not have any target version defined
- "Target version status" "is not" "Closed" returns all issues having a target version defined, which have the open or locked status
- "Target version due date" "none" returns all issues which have a target version defined, but for which no due date is defined
- current behaviour of Redmine, unchanged
- 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
Here I wasn't sure what to do because of the following behaviour:
- all issues which have a target version defined with no due date PLUS all issues not having any target version defined
- 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.
Updated by Toshi MARUYAMA over 8 years ago
- Related to Feature #23855: Target version filter should get an entry 'All open versions' added
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.
Updated by Toshi MARUYAMA about 8 years ago
- Related to deleted (Feature #23855: Target version filter should get an entry 'All open versions')
Updated by Toshi MARUYAMA about 8 years ago
- Has duplicate Feature #23855: Target version filter should get an entry 'All open versions' added
Updated by Go MAEDA about 8 years ago
- Has duplicate Feature #20197: Filter Issue by attribute of the Version added
Updated by Go MAEDA about 8 years ago
- Has duplicate Feature #14164: filter issue list by version status added
Updated by Go MAEDA almost 8 years ago
- Related to Feature #4891: Add version-date to the "Target version" drop down lists added
Updated by Go MAEDA almost 8 years ago
- Related to deleted (Feature #4891: Add version-date to the "Target version" drop down lists)
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
Updated by Holger Just almost 3 years ago
- Related to Patch #36824: Allow to filter issues by its version status with shared versions added