How to query issues with empty workLogged?

The query below works, but it doesn't include logged time for sub-tasks, so when there isn't logged time for issue but there are there is logged time for at least for one sub task, the issue is still the query result.  

issueFunction not in workLogged("after 2013/09/01 before 2020/09/30")

I would like the case when the time is logged to at least one sub task, the issue won't appear in the result set. Is it possible?

3 answers

1 accepted

This widget could not be displayed.

You can write your own JQL function which extends workLogged() function that it additionally returns issues with empty logged time which at least one sub-task have logged time.

 

String jqlQuery = "issueFunction in workLogged(\"" + operand.getArgs().get(0) + "\")";
SearchService.ParseResult parseResult = searchService.parseQuery(user, jqlQuery);

if (parseResult.isValid()){
    Query query = parseResult.getQuery();
    try {
        SearchResults results = searchService.search(user, query, PagerFilter.getUnlimitedFilter());
        List<Issue> issues = results.getIssues();

        for (Issue issue: issues){
            literals.add(new QueryLiteral(operand, issue.getId()));

            if (issue.isSubTask()){
                literals.add(new QueryLiteral(operand, issue.getParentId()));
            }
        }

    } catch (SearchException e) {
        // Catch exception
    }
}
This widget could not be displayed.

Hi Michal,

              When you use not in worklogged, why do you get Sub-tasks with logged time ?

This widget could not be displayed.

This is pretty tricky. Although I'm kind of fatigued at the moment so I might be missing something.

The problem is that you want to query on the worklog index, but you return results from the issue index. Perhaps you can use the above query with another query that uses childrenOf ("your jql") to find issues that have no log worked on the parent but does have work logged on the children.

 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

114 views 1 2
Join discussion

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