From 2dbb0766fdc5e5f1b671c213477aa8e4e342355d Mon Sep 17 00:00:00 2001 From: Robert Sparks Date: Wed, 16 Aug 2017 20:42:33 +0000 Subject: [PATCH] Improve the nominee status table to serve as a nomcom dashboard. Fixes #2261. Commit ready for merge. - Legacy-Id: 14057 --- ietf/nomcom/views.py | 23 +++++++++++- ietf/templates/nomcom/private_index.html | 48 +++++++++++++++++++----- 2 files changed, 61 insertions(+), 10 deletions(-) diff --git a/ietf/nomcom/views.py b/ietf/nomcom/views.py index b0b90f2db..89e3bc83b 100644 --- a/ietf/nomcom/views.py +++ b/ietf/nomcom/views.py @@ -31,6 +31,7 @@ from ietf.nomcom.utils import (get_nomcom_by_year, store_nomcom_private_key, get_hash_nominee_position, send_reminder_to_nominees, HOME_TEMPLATE, NOMINEE_ACCEPT_REMINDER_TEMPLATE,NOMINEE_QUESTIONNAIRE_REMINDER_TEMPLATE) from ietf.ietfauth.utils import role_required +from ietf.person.models import Person import debug # pyflakes:ignore @@ -184,13 +185,33 @@ def private_index(request, year): else: s[state['slug']] = all_nominee_positions.filter(position__name=s['position__name'], state=state['slug']).count() - s['total'] = all_nominee_positions.filter(position__name=s['position__name']).count() + s['nominations'] = Feedback.objects.filter(positions__id=s['position__id'], type='nomina').count() + s['nominees'] = all_nominee_positions.filter(position__name=s['position__name']).count() + s['comments'] = Feedback.objects.filter(positions__id=s['position__id'], type='comment').count() + + totals = dict() + totals['nominations'] = Feedback.objects.filter(nomcom=nomcom, type='nomina').count() + totals['nominees'] = all_nominee_positions.count() + for state in states: + if state['slug'] == questionnaire_state: + totals[state['slug']] = Feedback.objects.filter(nomcom=nomcom, type='questio').count() + else: + totals[state['slug']] = all_nominee_positions.filter(state=state['slug']).count() + totals['comments'] = Feedback.objects.filter(nomcom=nomcom, type='comment').count() + + unique_totals = dict() + unique_totals['nominees'] = Person.objects.filter(nominee__nomcom=nomcom).distinct().count() + for state in states: + if state['slug'] != questionnaire_state: + unique_totals[state['slug']] = len(set(all_nominee_positions.filter(state=state['slug']).values_list('nominee__person',flat=True))) return render(request, 'nomcom/private_index.html', {'nomcom': nomcom, 'year': year, 'nominee_positions': nominee_positions, 'stats': stats, + 'totals': totals, + 'unique_totals': unique_totals, 'states': states, 'positions': positions, 'selected_state': selected_state, diff --git a/ietf/templates/nomcom/private_index.html b/ietf/templates/nomcom/private_index.html index d5876e2ed..e766dff34 100644 --- a/ietf/templates/nomcom/private_index.html +++ b/ietf/templates/nomcom/private_index.html @@ -8,30 +8,58 @@ {% origin %}

Nomination status

- +
+
- - - - - - + + + + + + + + {% for item in stats %} + + - + {% endfor %} + + + + + + + + + + + + + + + + + + + + + +
PositionAcceptedDeclinedPendingQuestionnaire responseTotalPositionNominationsUnique NomineesAcceptedDeclinedPendingQuestionnaire responsesComments
{{ item.position__name }}{{ item.nominations }}{{ item.nominees }} {{ item.accepted }} {{ item.declined }} {{ item.pending }} {{ item.questionnaire }}{{ item.total }}{{ item.comments }}
Totals{{ totals.nominations }}{{ totals.nominees }}{{ totals.accepted }}{{ totals.declined }}{{ totals.pending }}{{ totals.questionnaire }}{{ totals.comments }}
Unique Nominee Totals-{{ unique_totals.nominees }}{{ unique_totals.accepted }}{{ unique_totals.declined }}{{ unique_totals.pending }}--
+

Nominees by position

@@ -66,11 +94,12 @@ +
{% if is_chair and nomcom.group.state_id == 'active' %}
{% csrf_token %} {% endif %} - +
{% if is_chair and nomcom.group.state_id == 'active' %}{% endif %} @@ -117,5 +146,6 @@ {% endif %} {% endif %} + {% endblock %}