Hotfix/wp grouping by users

https://community.openproject.org/work_packages/17685
Can't make it shorter without loosing readability or refactoring all the statements.