From dbbf47964b563fe71f91f04269349c8dc1973407 Mon Sep 17 00:00:00 2001 From: "J.-S. Caux" <J.S.Caux@uva.nl> Date: Thu, 17 Jan 2019 09:54:56 +0100 Subject: [PATCH] Add voting results to PotFel list --- .../templates/colleges/potentialfellowship_list.html | 2 +- colleges/templatetags/colleges_extras.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/colleges/templates/colleges/potentialfellowship_list.html b/colleges/templates/colleges/potentialfellowship_list.html index 6154aa24b..89e06dab9 100644 --- a/colleges/templates/colleges/potentialfellowship_list.html +++ b/colleges/templates/colleges/potentialfellowship_list.html @@ -121,7 +121,7 @@ $(document).ready(function($) { <div class="single d-inline" data-specialization="{{expertise|lower}}" data-toggle="tooltip" data-placement="bottom" title="{{expertise|get_specialization_display}}">{{expertise|get_specialization_code}}</div> {% endfor %} </td> - <td style="color: #ffffff; background-color:{{ potfel.status|potfelstatuscolor }};">{{ potfel.get_status_display }}</td> + <td style="color: #ffffff; background-color:{{ potfel.status|potfelstatuscolor }};">{{ potfel.get_status_display }} <small>{% voting_results_display potfel %}</small></td> <td>{{ potfel.latest_event_details }}</td> </tr> {% empty %} diff --git a/colleges/templatetags/colleges_extras.py b/colleges/templatetags/colleges_extras.py index edabc0620..13a510c61 100644 --- a/colleges/templatetags/colleges_extras.py +++ b/colleges/templatetags/colleges_extras.py @@ -57,3 +57,13 @@ def potfelstatuscolor(status): elif status == POTENTIAL_FELLOWSHIP_SCIPOST_EMERITUS: color = hslColorWheel(12, 4, 40, 40) return color + + +@register.simple_tag +def voting_results_display(potfel): + if potfel.status == POTENTIAL_FELLOWSHIP_ELECTION_VOTE_ONGOING: + return ' Agree: %s, Abstain: %s, Disagree: %s' % ( + potfel.in_agreement.count(), + potfel.in_abstain.count(), + potfel.in_disagreement.count()) + return '' -- GitLab