How can I create a filter that applies another filter to all of a story's sub-tasks?

Tonya Ohrel September 10, 2014

On our board, we have stories displaying in swim lanes, and all sub-tasks for that story appear in the swim lane under their parent story.

The filter I want is for my testers, I want to only display stories that are "ready for testing".  Stories are  ready for testing when all dev tasks are moved to "Done" and only test tasks remain.

Therefore, I want to filter my board so that stories only display if "Status != Done" AND ALL sub-tasks are in this filter: "Status = Done OR (Status != Done AND issuetype = Story-test)".  

something like this I imagine:

issuetype = Story AND Status != Done AND <has no sub-tasks> in !(Status = Done OR (Status != Done AND issuetype = Story-test))

I just don't now how to represent the "has no sub-tasks" part in JQL.

1 answer

1 accepted

1 vote
Answer accepted
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 10, 2014

If you use Script Runner, or can use it, you can use a filter like:

issueFunction in parentsOf("resolution is not empty") and not issueFunction in parentsOf("resolution is empty") and status != Done

I haven't used all your clauses to make it easier to understand. But basically you are getting all the parents of subtaks where the resolution is set (use status = Done if you want), and excluding the parents that have at least one subtask where the resolution is empty.

The combined effect is "all subtasks done"... but there must be at least one subtask. 

There is probably an easier way, although I do know you can't do this general case without plugins.

Tonya Ohrel September 10, 2014

Great, Jamie, thank you... this gets me 99% of the way there...

The following ScriptRunner query successfully shows the stories that fit my criteria

issueFunction in parentsOf("issuetype = Story-test and Status != Done") and not issueFunction in parentsOf("issuetype != Story-test and Status != Done") and Status != Done

 

However, while the stories display, the test tasks do not.  So I would like to take it 1 step further, and display the Story-test children of the parents that are indicated by the above.  I tried something like this:

issueFunction in subtasksOf("issueFunction in parentsOf(\"issuetype = Story-test and Status != Done\") and not issueFunction in parentsOf(\"issuetype != Story-test and Status != Done\") and Status != Done") and issuetype = Story-test

But it gave me a "red X" and would not allow me to save it.

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2014

hrm... I would save the working filter that gets the stories and note the ID, which will be like 12345. Then this should work: filter = 12345 or issueFunction in childrenOf("filter = 12345")

Tonya Ohrel September 11, 2014

Actually I guess I just had a syntax issue in the above... I have it working now with the following: issueFunction in subtasksOf("issueFunction in parentsOf(\"issuetype = Story-test and Status = Open\") and not issueFunction in parentsOf(\"issuetype != Story-test and Status != Done\")") Thanks so much!

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2014

and then filter in or out the story-test or whatever subtask it is you don't want.

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2014

no problem, nice one.

Suggest an answer

Log in or Sign up to answer