Merged in [14057] from rjsparks@nostrum.com:

Improve the nominee status table to serve as a nomcom dashboard. Fixes #2261.
 - Legacy-Id: 14067
Note: SVN reference [14057] has been migrated to Git commit 2dbb0766fd
This commit is contained in:
Henrik Levkowetz 2017-08-23 15:06:12 +00:00
commit 2b2753635f
2 changed files with 61 additions and 10 deletions

View file

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

View file

@ -8,30 +8,58 @@
{% origin %}
<h2>Nomination status</h2>
<table class="table table-condensed table-striped">
<div class="table-responsive">
<table class="table table-condensed table-striped table-hover col-sm-10">
<thead>
<tr>
<th>Position</th>
<th>Accepted</th>
<th>Declined</th>
<th>Pending</th>
<th>Questionnaire response</th>
<th>Total</th>
<th class="col-sm-3">Position</th>
<th class="col-sm-1">Nominations</th>
<th class="col-sm-1">Unique Nominees</th>
<th class="col-sm-1">Accepted</th>
<th class="col-sm-1">Declined</th>
<th class="col-sm-1">Pending</th>
<th class="col-sm-1">Questionnaire responses</th>
<th class="col-sm-1">Comments</th>
</tr>
</thead>
<tbody>
{% for item in stats %}
<tr>
<td>{{ item.position__name }}</td>
<td>{{ item.nominations }}</td>
<td>{{ item.nominees }}</td>
<td>{{ item.accepted }}</td>
<td>{{ item.declined }}</td>
<td>{{ item.pending }}</td>
<td>{{ item.questionnaire }}</td>
<td>{{ item.total }}</td>
<td>{{ item.comments }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th>Totals</th>
<th>{{ totals.nominations }}</th>
<th>{{ totals.nominees }}</th>
<th>{{ totals.accepted }}</th>
<th>{{ totals.declined }}</th>
<th>{{ totals.pending }}</th>
<th>{{ totals.questionnaire }}</th>
<th>{{ totals.comments }}</th>
</tr>
<tr>
<th>Unique Nominee Totals</th>
<th>-</th>
<th>{{ unique_totals.nominees }}</th>
<th>{{ unique_totals.accepted }}</th>
<th>{{ unique_totals.declined }}</th>
<th>{{ unique_totals.pending }}</th>
<th>-</th>
<th>-</th>
</tr>
</tfoot>
</table>
</div>
<h2>Nominees by position</h2>
@ -66,11 +94,12 @@
</form>
<div class="table-responsive">
{% if is_chair and nomcom.group.state_id == 'active' %}
<form class="form-inline" id="batch-action-form" method="post">{% csrf_token %}
{% endif %}
<table class="table table-condensed table-striped">
<table class="table table-condensed table-striped table-hover">
<thead>
<tr>
{% if is_chair and nomcom.group.state_id == 'active' %}<th colspan="2"><span class="fa fa-check"></span></th>{% endif %}
@ -117,5 +146,6 @@
</form>
{% endif %}
{% endif %}
</div>
{% endblock %}