From f2681fe634dfacdf119b8bdb53a5456cdd644ac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Jim=C3=A9nez?= Date: Tue, 5 Mar 2013 10:17:16 +0000 Subject: [PATCH] See #965 * list of all nominees along with their accept or decline status * reports of the accept or decline status both per nominee as well as per open position. * summary report containing statistics (total/accept/decline/no response) - Legacy-Id: 5478 --- ietf/nomcom/views.py | 14 +++++- ietf/templates/nomcom/private_index.html | 61 +++++++++++++++++++++++- 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/ietf/nomcom/views.py b/ietf/nomcom/views.py index 7e0a06443..2e219a298 100644 --- a/ietf/nomcom/views.py +++ b/ietf/nomcom/views.py @@ -6,13 +6,14 @@ from django.shortcuts import render_to_response from django.template import RequestContext from django.template.loader import render_to_string from django.utils import simplejson +from django.db.models import Count from ietf.dbtemplate.models import DBTemplate from ietf.dbtemplate.views import template_edit from ietf.nomcom.decorators import member_required, private_key_required from ietf.nomcom.forms import (EditPublicKeyForm, NominateForm, MergeForm, NomComTemplateForm, PositionForm, PrivateKeyForm) -from ietf.nomcom.models import Position +from ietf.nomcom.models import Position, NomineePosition from ietf.nomcom.utils import (get_nomcom_by_year, HOME_TEMPLATE, retrieve_nomcom_private_key, store_nomcom_private_key) @@ -54,9 +55,20 @@ def private_key(request, year): @member_required(role='member') def private_index(request, year): nomcom = get_nomcom_by_year(year) + nominee_positions = NomineePosition.objects.all() + stats = NomineePosition.objects.values('position__name').annotate(total=Count('position')) + for s in stats: + for state in ['pending', 'accepted', 'declined', 'questionnaire', 'pending']: + if state == 'questionnaire': + s[state] = NomineePosition.objects.filter(position__name=s['position__name'], questionnaires__isnull=False).count() + else: + s[state] = NomineePosition.objects.filter(position__name=s['position__name'], state=state).count() + return render_to_response('nomcom/private_index.html', {'nomcom': nomcom, 'year': year, + 'nominee_positions': nominee_positions, + 'stats': stats, 'selected': 'index'}, RequestContext(request)) diff --git a/ietf/templates/nomcom/private_index.html b/ietf/templates/nomcom/private_index.html index 5d5b71603..abf9874a9 100644 --- a/ietf/templates/nomcom/private_index.html +++ b/ietf/templates/nomcom/private_index.html @@ -7,4 +7,63 @@

Nomine administration

The following is a list of registered nominees. (You can request confirmation from nominees if they haven't replied to the nomination notification they have received.)

-{% endblock %} + +

Nominations stats

+ + + + + + + + + + +{% for item in stats %} + + + + + + + + +{% endfor %} +
PositionAcceptedDeclinedQuestionnairePendingTotal
+ {{ item.position__name }} + + {{ item.accepted }} + + {{ item.declined }} + + {{ item.questionnaire }} + + {{ item.pending }} + + {{ item.total }} +
+ +

List of nominees

+ + + + + + + +{% for np in nominee_positions %} + + + + + +{% endfor %} +
NomineesPositionState
+ {{ np.nominee }} + + {{ np.position }} + + {{ np.state }} +
+ +{% endblock %} \ No newline at end of file