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 %}
Position | -Accepted | -Declined | -Pending | -Questionnaire response | -Total | +Position | +Nominations | +Unique Nominees | +Accepted | +Declined | +Pending | +Questionnaire responses | +Comments |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{{ 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 }} | +- | +- | +