diff --git a/openslides/participant/templates/participant/overview.html b/openslides/participant/templates/participant/overview.html index 772218314..1e69a59a3 100644 --- a/openslides/participant/templates/participant/overview.html +++ b/openslides/participant/templates/participant/overview.html @@ -52,7 +52,11 @@

- {{ users|length }} {% trans "Participant" %} + {% if users|length == allusers|length %} + {{ users|length }} {% trans "Participants" %} + {% else %} + {{ users|length }} {% trans "of" %} {{ allusers|length }} {% trans "Participants" %} (= {{ percent }} %) + {% endif %} diff --git a/openslides/participant/views.py b/openslides/participant/views.py index debb27a26..062ff8dfb 100644 --- a/openslides/participant/views.py +++ b/openslides/participant/views.py @@ -92,6 +92,7 @@ def get_overview(request): if 'reverse' in sortfilter: query = query.reverse() + # list of filtered users (with profile) userlist = query.all() users = [] for user in userlist: @@ -100,10 +101,27 @@ def get_overview(request): users.append(user) except Profile.DoesNotExist: pass + # list of all existing users (with profile) + allusers = [] + for user in User.objects.all(): + try: + user.get_profile() + allusers.append(user) + except Profile.DoesNotExist: + pass + # quotient of selected users and all users + if len(allusers) > 0: + percent = float(len(users)) * 100 / float(len(allusers)) + else: + percent = 0 + # list of all existing groups groups = [p['group'] for p in Profile.objects.values('group').exclude(group='').distinct()] + # list of all existing committees committees = [p['committee'] for p in Profile.objects.values('committee').exclude(committee='').distinct()] return { 'users': users, + 'allusers': allusers, + 'percent': round(percent, 1), 'groups': groups, 'committees': committees, 'cookie': ['participant_sortfilter', urlencode(decodedict(sortfilter), doseq=True)],
{%trans "First Name" %}