* 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
This commit is contained in:
Emilio Jiménez 2013-03-05 10:17:16 +00:00
parent 9b00517449
commit f2681fe634
2 changed files with 73 additions and 2 deletions

View file

@ -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))

View file

@ -7,4 +7,63 @@
<h2>Nomine administration</h2>
<p>The following is a list of registered nominees. (You can <a href="#"> request confirmation<a> from nominees if they haven't
replied to the nomination notification they have received.)</p>
{% endblock %}
<h2>Nominations stats</h2>
<table class="ietf-table ietf-doctable">
<tr>
<th>Position</th>
<th>Accepted</th>
<th>Declined</th>
<th>Questionnaire</th>
<th>Pending</th>
<th>Total</th>
</tr>
{% for item in stats %}
<tr class="{{ forloop.counter|divisibleby:2|yesno:"oddrow,evenrow" }}">
<td>
{{ item.position__name }}
</td>
<td>
{{ item.accepted }}
</td>
<td>
{{ item.declined }}
</td>
<td>
{{ item.questionnaire }}
</td>
<td>
{{ item.pending }}
</td>
<td>
{{ item.total }}
</td>
</tr>
{% endfor %}
</table>
<h2>List of nominees</h2>
<table class="ietf-table ietf-doctable">
<tr>
<th>Nominees</th>
<th>Position</th>
<th>State</th>
</tr>
{% for np in nominee_positions %}
<tr class="{{ forloop.counter|divisibleby:2|yesno:"oddrow,evenrow" }}">
<td>
{{ np.nominee }}
</td>
<td>
{{ np.position }}
</td>
<td class="status">
{{ np.state }}
</td>
</tr>
{% endfor %}
</table>
{% endblock %}