From ad02cb05aeef638863c5e5e3ffedebf040cc73f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Wed, 4 Jul 2012 00:40:25 +0200 Subject: [PATCH] Draft for vote result table on assignment view and projector. Publishing still not working. --- openslides/assignment/models.py | 2 +- .../assignment/templates/assignment/view.html | 88 ++++++----- .../templates/projector/Assignment.html | 142 +++++++++--------- 3 files changed, 120 insertions(+), 112 deletions(-) diff --git a/openslides/assignment/models.py b/openslides/assignment/models.py index 36759b0a9..03f3ef99f 100644 --- a/openslides/assignment/models.py +++ b/openslides/assignment/models.py @@ -157,7 +157,7 @@ class Assignment(models.Model, SlideMixin): data['assignment'] = self data['title'] = self.name data['polls'] = self.poll_set.all() - data['votes'] = self.vote_results + data['vote_results'] = self.vote_results data['template'] = 'projector/Assignment.html' return data diff --git a/openslides/assignment/templates/assignment/view.html b/openslides/assignment/templates/assignment/view.html index 74ca2ca2b..1647a9c69 100644 --- a/openslides/assignment/templates/assignment/view.html +++ b/openslides/assignment/templates/assignment/view.html @@ -99,6 +99,7 @@ {% if polls %} + {% with ballotnumber=polls.count %} @@ -107,24 +108,25 @@ {% endwith %} + {% for poll in polls %} - {# if poll.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment #} + {% if poll.published or perms.assignment.can_manage_assignment %} - {# endif #} + {% endif %} {% endfor %} {% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %} {% endif %} + {% for candidate, votes in vote_results.items %} - - + - {% for vote in votes %} + {% else %} + {% if perms.assignment.can_manage_assignment %} + + {% endif %} + {% endif %} + {{ candidate }} + + {% for vote in votes %} + {% if perms.assignment.can_manage_assignment %} + {# Hier stimmt es noch nicht. Es muss rein, dass veröffentlichte Wahlergebnisse für jedermann sichtbar sind #} - {% endfor %} - {% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %} - {% endif %} - + {% endfor %} + {% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %} + + {% endif %} + {% endfor %} + {% for poll in polls %} - {% if poll.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment %} + {% if poll.published or perms.assignment.can_manage_assignment %} {% endif %} {% endfor %} @@ -183,10 +190,11 @@ {% endif %} + - + {% for poll in polls %} - {% if poll.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment %} + {% if poll.published or perms.assignment.can_manage_assignment %} {% endif %} {% endfor %} diff --git a/openslides/assignment/templates/projector/Assignment.html b/openslides/assignment/templates/projector/Assignment.html index 3d9e021e1..8d4689cba 100644 --- a/openslides/assignment/templates/projector/Assignment.html +++ b/openslides/assignment/templates/projector/Assignment.html @@ -27,88 +27,88 @@ {% block scrollcontent %} {% if not assignment.profile.exists %} -

-

{{ assignment.description|linebreaks }}
-

+

+

{{ assignment.description|linebreaks }}
+

{% endif %} {% if assignment.profile.exists and assignment.status != "fin" %} -

{% trans "Candidates" %}

-
    - {% for profile in assignment.profile.all|dictsort:"user.first_name" %} -
  1. {{ profile }}
  2. - {% empty %} -
  3. - {% trans "No candidates available." %} -
  4. - {% endfor %} -
-


+

{% trans "Candidates" %}

+
    + {% for profile in assignment.profile.all|dictsort:"user.first_name" %} +
  1. {{ profile }}
  2. + {% empty %} +
  3. + {% trans "No candidates available." %} +
  4. + {% endfor %} +
+


{% endif %} {% if polls.exists %} -

{% trans "Election results" %}

-
{% trans "Candidates" %} {{ forloop.counter }}. {% trans 'ballot' %} {% if perms.assignment.can_manage_assignment %} -
- - - - - +
+ + + + + {% endif %}
@@ -136,46 +138,51 @@
- {% if candidate in assignment.elected.all %} - {% if perms.assignment.can_manage_assignment %} - - {% else %} - - {% endif %} +
+ {% if candidate in assignment.elected.all %} + {% if perms.assignment.can_manage_assignment %} + {% else %} - {% if perms.assignment.can_manage_assignment %} - - {% endif %} + {% endif %} - {{ candidate }} - - {% if vote %} - {% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %} - {% if vote.Yes %}{{ vote.Yes }}{% else %}∅{% endif %}
- {% if vote.No %}{{ vote.No }}{% else %}∅{% endif %}
- {% if vote.Abstain %}{{ vote.Abstain }}{% else %}∅{% endif %}
- {% elif 'Votes' in vote %} - {% if vote.Votes %}{{ vote.Votes }}{% else %}∅{% endif %} - {% endif %} + {% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %} + {{ vote.Yes }}
+ {{ vote.No }}
+ {{ vote.Abstain }}
+ {% elif 'Votes' in vote %} + {{ vote.Votes }} + {% elif vote == None %} + {% trans 'was not a
candidate'%} {% else %} - – +   {% endif %}
{%trans 'Invalid votes' %} {{ poll.print_votesinvalid }}
{%trans 'Votes cast' %}{%trans 'Votes cast' %} {{ poll.print_votescast }}
- - - {% for poll in assignment.poll_set.all %} - {% if poll.published %} - - {% endif %} - {% endfor %} - - {% for vote in votes %} - - {% with vote|first as candidate %} - + + {% for poll in polls %} + {% if poll.published %} + + {% endif %} + {% endfor %} + + + + + {% for poll in polls %} + {% if poll.published %} + + {% endif %} + {% endfor %} + +
{% trans "Candidates" %}{{forloop.counter}}. {% trans "ballot" %}
- {% if candidate.1 %} - - - +

{% trans "Election results" %}

+ + + + + {% for poll in assignment.poll_set.all %} + {% if poll.published %} + {% endif %} - {{ candidate.0 }} - - {% for v in vote|last %} - + + {% for candidate, votes in vote_results.items %} + + + {% for vote in votes %} + {# Hier stimmt es noch nicht. Es muss rein, dass nur veröffentlichte Wahlergebnisse angezeigt werden sollen #} + {% endfor %} - {% endwith %} - - {% empty %} - - - - {% endfor %} - - - {% for p in polls %} - {% if p.published %} - - {% endif %} + {% endfor %} - - - - {% for p in polls %} - {% if p.published %} - - {% endif %} - {% endfor %} - -
{% trans "Candidates" %}{{forloop.counter}}. {% trans "ballot" %} - {% if v %} - {% if v|length == 3 %} - {% if v.0 %}{{ v.0 }}{% else %}∅{% endif %}
- {% if v.1 %}{{ v.1 }}{% else %}∅{% endif %}
- {% if v.2 %}{{ v.2 }}{% else %}∅{% endif %}
- {% else %} - {% if v != "-" %} - - {% endif %} - {{ v.0 }} + {% endfor %} +
+ {% if candidate in assignment.elected.all %} + + + + {% endif %} + {{ candidate }} + + {% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %} + {{ vote.Yes }}
+ {{ vote.No }}
+ {{ vote.Abstain }}
+ {% elif 'Votes' in vote %} + {{ vote.Votes }} + {% elif vote == None %} + {% trans 'was not a
candidate'%} + {% else %} +   {% endif %} - {% endif %}
{% trans "No ballots available." %}
{%trans 'Invalid votes' %} {{ p.print_votesinvalid }}
{%trans 'Votes cast' %} {{ p.print_votescast }}
- {% endif %} + +
{%trans 'Invalid votes' %} {{ poll.print_votesinvalid }}
{%trans 'Votes cast' %} {{ poll.print_votescast }}
+ {% elif assignment.profile.exists %} + {% trans "No ballots available." %} + {% endif %}
{% endblock %}