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):