Feature #20129

Filter by subtasks to some level of depth

Added by Sebastian Paluch over 2 years ago. Updated over 1 year ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Issues filter
Target version:-
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.

History

#1 Updated by Sebastian Paluch over 2 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

#2 Updated by Sebastian Paluch over 2 years ago

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

#3 Updated by Toshi MARUYAMA over 2 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.

#5 Updated by Toshi MARUYAMA almost 2 years ago

  • Category changed from Issues to Issues filter

#6 Updated by Sebastian Paluch over 1 year ago

Toshi MARUYAMA wrote:

Please post by patch and add tests.

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

#7 Updated by Toshi MARUYAMA over 1 year 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

Also available in: Atom PDF