Project

General

Profile

Actions

Feature #20129

open

Filter by subtasks to some level of depth

Added by Sebastian Paluch almost 9 years ago. Updated about 3 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Issues filter
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

With respect to #6118, the only option that seems to be missing under "subtasks" is ability to show issue hierarchy depth to some level. This is useful to see overall list of job to do for a project to some level of details.

Actions #1

Updated by Sebastian Paluch almost 9 years ago

Here is the SQL for "subtasks_depth" filter:

      def sql_for_subtasks_depth_field(field, operator, value)
       case operator
       when "*" 
         return
       when "!*" 
         "(SELECT (COUNT(parents.id) - 1) FROM #{Issue.table_name} AS parents WHERE #{Issue.table_name}.lft BETWEEN parents.lft AND parents.rgt AND #{Issue.table_name}.root_id = parents.root_id) = 0"    
       when "><" 
         depth_from = value.first.to_i || 0
         depth_to = value.last.to_i || 0
         if depth_from > 0
           depth_from = depth_from -1
         end
         if depth_to > 0
           depth_to = depth_to -1
         end
         "(SELECT (COUNT(parents.id) - 1) FROM #{Issue.table_name} AS parents WHERE #{Issue.table_name}.lft BETWEEN parents.lft AND parents.rgt AND #{Issue.table_name}.root_id = parents.root_id) BETWEEN " + depth_from.to_s    + " AND " + depth_to.to_s
       else
            depth = value.last.to_i || 0
         if depth > 0
           depth = depth -1
         end
         "(SELECT (COUNT(parents.id) - 1) FROM #{Issue.table_name} AS parents WHERE #{Issue.table_name}.lft BETWEEN parents.lft AND parents.rgt AND #{Issue.table_name}.root_id = parents.root_id) " + operator + " " + depth.to_s
       end
      end
Actions #2

Updated by Sebastian Paluch over 8 years ago

Is there a chance to add this in one of the 3.1.x release?

Actions #3

Updated by Toshi MARUYAMA over 8 years ago

Sebastian Paluch wrote:

Is there a chance to add this in one of the 3.1.x release?

Please post by patch and add tests.

Actions #4

Updated by Ezequiel Hernandez about 8 years ago

+1

Actions #5

Updated by Toshi MARUYAMA about 8 years ago

  • Category changed from Issues to Issues filter
Actions #6

Updated by Sebastian Paluch almost 8 years ago

Toshi MARUYAMA wrote:

Please post by patch and add tests.

I would but unfortunately I don't know how to add tests :/

Actions #7

Updated by Toshi MARUYAMA almost 8 years ago

Sebastian Paluch wrote:

Toshi MARUYAMA wrote:

Please post by patch and add tests.

I would but unfortunately I don't know how to add tests :/

source:trunk/test

Actions #8

Updated by Yasu Saku about 3 years ago

+1

Actions

Also available in: Atom PDF