f_a
August 6, 2018, 11:13am
1
I am using the or() method of TaskQuery to find all tasks that have been either assigned to a user or which he is a candidate for:
Logger.info("assigned tasks {}", taskService.createTaskQuery().taskAssignee(user).count());
Logger.info("candidate tasks {}", taskService.createTaskQuery().taskCandidateUser(user).count());
Logger.info("assigned or candidate tasks {}", taskService.createTaskQuery().or().taskCandidateUser(user).taskAssignee(user).endOr().count());
Output:
[info] application - assigned tasks 14
[info] application - candidate tasks 2
[info] application - assigned or candidate tasks 0
I expected the last query to include all 16 tasks, how to achieve that?
yeah smells buggy, i get a result, which is inconsistent, by using the same syntax you are using:
//this is groovy
String userName='admin'
int assignedTasks = taskService.createTaskQuery()
.taskAssignee(userName)
.list().size()
int candidateTasks = taskService.createTaskQuery()
.taskCandidateUser(userName)
.list().size()
println "User assigned (" +assignedTasks + "), user candidate (" + candidateTasks + "), User " + userName + " has in total tasks: " +
taskService.createTaskQuery()
.or()
.taskCandidateUser(userName)
.taskAssignee(userName)
.endOr()
.list().size()
and a result is:
User assigned (18), user candidate (2), User admin has in total tasks: 17
I tried a rest api:
/camunda/rest/task/count
with post:
{
"candidateUser":"admin",
"includeAssignedTasks":"true",
"orQueries": [
{
"assignee":"admin",
"candidateUser":"admin"
}
]
}
gave me back the same wrong number of tasks 17. loosing couple of assigned tasks in the middle…
f_a
August 9, 2018, 8:25am
3
Thanks for reproducing the problem. A bummer, we were quite excited about that new or() method. Will have to do multiple queries then or hit the database.