From 1a33c1c9f1707279bc086a11004f7a2e38d8963e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Tue, 19 Nov 2013 00:17:36 +0100 Subject: [PATCH] Add percent base value to all polls, fix #1079. --- CHANGELOG | 2 ++ openslides/poll/models.py | 2 +- tests/motion/test_views.py | 11 +++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 2990e98f7..ab4f83a05 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -20,6 +20,8 @@ Motions: - Enabled attachments for motions. Elections: - Refactored assignment app to use class based views instead of functions. +Polls: +- Added percent base to votes cast values. Participants: - Updated access data PDF: WLAN access (with QRCode for WLAN ssid/password) and OpenSlides access (with QRCode for system URL), printed on a single A4 page diff --git a/openslides/poll/models.py b/openslides/poll/models.py index 3bef36a14..021cccc6e 100644 --- a/openslides/poll/models.py +++ b/openslides/poll/models.py @@ -70,7 +70,7 @@ class CountVotesCast(models.Model): fields.append('votescast') def print_votescast(self): - return print_value(self.votescast) + return print_value(self.votescast, self.percent_base()) def percent_base(self): if self.votescast > 0: diff --git a/tests/motion/test_views.py b/tests/motion/test_views.py index f31295960..2c4b4d9e8 100644 --- a/tests/motion/test_views.py +++ b/tests/motion/test_views.py @@ -80,6 +80,17 @@ class TestMotionDetailView(MotionViewTestCase): self.assertNotContains(response, '

Attachments:

') self.assertNotContains(response, 'TestFile_Neiri4xai4ueseGohzid') + def test_poll(self): + response = self.staff_client.get('/motion/1/create_poll/') + self.assertRedirects(response, '/motion/1/poll/1/edit/') + response = self.staff_client.post( + '/motion/1/poll/1/edit/', + {'option-1-Yes': '10', + 'pollform-votescast': '50'}) + self.assertRedirects(response, '/motion/1/') + response = self.staff_client.get('/motion/1/') + self.assertContains(response, '100.00 %') + class TestMotionDetailVersionView(MotionViewTestCase): def test_get(self):