Skip to content

Commit f2681fe

Browse files
committed
* 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
1 parent 9b00517 commit f2681fe

2 files changed

Lines changed: 73 additions & 2 deletions

File tree

ietf/nomcom/views.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
from django.template import RequestContext
77
from django.template.loader import render_to_string
88
from django.utils import simplejson
9+
from django.db.models import Count
910

1011
from ietf.dbtemplate.models import DBTemplate
1112
from ietf.dbtemplate.views import template_edit
1213
from ietf.nomcom.decorators import member_required, private_key_required
1314
from ietf.nomcom.forms import (EditPublicKeyForm, NominateForm, MergeForm,
1415
NomComTemplateForm, PositionForm, PrivateKeyForm)
15-
from ietf.nomcom.models import Position
16+
from ietf.nomcom.models import Position, NomineePosition
1617
from ietf.nomcom.utils import (get_nomcom_by_year, HOME_TEMPLATE,
1718
retrieve_nomcom_private_key,
1819
store_nomcom_private_key)
@@ -54,9 +55,20 @@ def private_key(request, year):
5455
@member_required(role='member')
5556
def private_index(request, year):
5657
nomcom = get_nomcom_by_year(year)
58+
nominee_positions = NomineePosition.objects.all()
59+
stats = NomineePosition.objects.values('position__name').annotate(total=Count('position'))
60+
for s in stats:
61+
for state in ['pending', 'accepted', 'declined', 'questionnaire', 'pending']:
62+
if state == 'questionnaire':
63+
s[state] = NomineePosition.objects.filter(position__name=s['position__name'], questionnaires__isnull=False).count()
64+
else:
65+
s[state] = NomineePosition.objects.filter(position__name=s['position__name'], state=state).count()
66+
5767
return render_to_response('nomcom/private_index.html',
5868
{'nomcom': nomcom,
5969
'year': year,
70+
'nominee_positions': nominee_positions,
71+
'stats': stats,
6072
'selected': 'index'}, RequestContext(request))
6173

6274

ietf/templates/nomcom/private_index.html

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,63 @@
77
<h2>Nomine administration</h2>
88
<p>The following is a list of registered nominees. (You can <a href="#"> request confirmation<a> from nominees if they haven't
99
replied to the nomination notification they have received.)</p>
10-
{% endblock %}
10+
11+
<h2>Nominations stats</h2>
12+
13+
<table class="ietf-table ietf-doctable">
14+
<tr>
15+
<th>Position</th>
16+
<th>Accepted</th>
17+
<th>Declined</th>
18+
<th>Questionnaire</th>
19+
<th>Pending</th>
20+
<th>Total</th>
21+
</tr>
22+
{% for item in stats %}
23+
<tr class="{{ forloop.counter|divisibleby:2|yesno:"oddrow,evenrow" }}">
24+
<td>
25+
{{ item.position__name }}
26+
</td>
27+
<td>
28+
{{ item.accepted }}
29+
</td>
30+
<td>
31+
{{ item.declined }}
32+
</td>
33+
<td>
34+
{{ item.questionnaire }}
35+
</td>
36+
<td>
37+
{{ item.pending }}
38+
</td>
39+
<td>
40+
{{ item.total }}
41+
</td>
42+
</tr>
43+
{% endfor %}
44+
</table>
45+
46+
<h2>List of nominees</h2>
47+
48+
<table class="ietf-table ietf-doctable">
49+
<tr>
50+
<th>Nominees</th>
51+
<th>Position</th>
52+
<th>State</th>
53+
</tr>
54+
{% for np in nominee_positions %}
55+
<tr class="{{ forloop.counter|divisibleby:2|yesno:"oddrow,evenrow" }}">
56+
<td>
57+
{{ np.nominee }}
58+
</td>
59+
<td>
60+
{{ np.position }}
61+
</td>
62+
<td class="status">
63+
{{ np.state }}
64+
</td>
65+
</tr>
66+
{% endfor %}
67+
</table>
68+
69+
{% endblock %}

0 commit comments

Comments
 (0)