From ea4903430957fe263e4a77fca5aa5efc9815ecd4 Mon Sep 17 00:00:00 2001 From: Florian M Date: Mon, 1 Feb 2021 11:50:04 +0100 Subject: [PATCH] Fix project usersWithActiveTasks query (#5115) * Fix project usersWithActiveTasks query * changelog * Merge branch 'master' into user-email-complex-query --- CHANGELOG.unreleased.md | 1 + app/models/project/Project.scala | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 73e61c8c73..f6dfa46417 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -22,6 +22,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released ### Fixed - Fixed a bug where the user could delete teams that were still referenced in annotations, projects or task types, thus creating invalid state. [#5108](https://github.com/scalableminds/webknossos/pull/5108/files) +- Fixed a bug where the listing of users that have open tasks of a project failed. [#5115](https://github.com/scalableminds/webknossos/pull/5115) ### Removed - The isosurface setting was removed. Instead, isosurfaces can be generated via the "Meshes" tab. Also note that the Shift+Click binding for generating an isosurface was removed (for now). Please refer to the "Meshes" tab, too. [#4917](https://github.com/scalableminds/webknossos/pull/4917) diff --git a/app/models/project/Project.scala b/app/models/project/Project.scala index 54097818a2..45a8f5aab3 100755 --- a/app/models/project/Project.scala +++ b/app/models/project/Project.scala @@ -124,16 +124,17 @@ class ProjectDAO @Inject()(sqlClient: SQLClient)(implicit ec: ExecutionContext) def findUsersWithActiveTasks(name: String): Fox[List[(String, String, String, Int)]] = for { - rSeq <- run(sql"""select u.email, u.firstName, u.lastName, count(a._id) + rSeq <- run(sql"""select m.email, u.firstName, u.lastName, count(a._id) from webknossos.annotations_ a join webknossos.tasks_ t on a._task = t._id join webknossos.projects_ p on t._project = p._id join webknossos.users_ u on a._user = u._id + join webknossos.multiusers_ m on u._multiUser = m._id where p.name = $name and a.state = '#${AnnotationState.Active.toString}' and a.typ = '#${AnnotationType.Task}' - group by u.email, u.firstName, u.lastName + group by m.email, u.firstName, u.lastName """.as[(String, String, String, Int)]) } yield rSeq.toList