Add percent base value to all polls, fix #1079.

This commit is contained in:
Norman Jäckel 2013-11-19 00:17:36 +01:00
parent 962636f84c
commit 1a33c1c9f1
3 changed files with 14 additions and 1 deletions

View File

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

View File

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

View File

@ -80,6 +80,17 @@ class TestMotionDetailView(MotionViewTestCase):
self.assertNotContains(response, '<h4>Attachments:</h4>')
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):