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

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

This widget could not be displayed.

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.

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.

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")

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!

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

no problem, nice one.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Apr 22, 2018 in Jira Software

How-to setup a secured Jira Software 7.9.0 on Ubuntu 16.04.4 in less than 30 minutes

...PermissionsStartOnly=true User=www-data Group=www-data ExecStart=/opt/jira/bin/startup.sh ExecStop=/opt/jira/bin/shutdown.sh TimeoutStartSec=120 TimeoutStopSec=600 PrivateTmp=true [Install] WantedBy...

1,508 views 10 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you