From bd3c8e09d8495f25f3b15083fefb25a2e35b2aa8 Mon Sep 17 00:00:00 2001 From: Finn Stutzenstein Date: Thu, 10 Jun 2021 08:46:14 +0200 Subject: [PATCH] Clear entitled votes after reset --- server/openslides/poll/models.py | 1 + server/requirements/development.txt | 2 ++ server/tests/integration/motions/test_polls.py | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/server/openslides/poll/models.py b/server/openslides/poll/models.py index 427256156..b867cb521 100644 --- a/server/openslides/poll/models.py +++ b/server/openslides/poll/models.py @@ -253,6 +253,7 @@ class BasePoll(models.Model): option.reset() self.voted.clear() + self.entitled_users_at_stop = None # Reset state self.state = BasePoll.STATE_CREATED diff --git a/server/requirements/development.txt b/server/requirements/development.txt index c419bae22..13348e7b9 100644 --- a/server/requirements/development.txt +++ b/server/requirements/development.txt @@ -7,3 +7,5 @@ pytest<5.4.2 pytest-django<3.9.0 pytest-asyncio<0.11.0 pytest-cov<2.8.2 +types-bleach +types-pkg_resources diff --git a/server/tests/integration/motions/test_polls.py b/server/tests/integration/motions/test_polls.py index bed55ff81..d205d7647 100644 --- a/server/tests/integration/motions/test_polls.py +++ b/server/tests/integration/motions/test_polls.py @@ -1394,6 +1394,7 @@ class ResetMotionPoll(TestCase): pollmethod="YNA", type=BasePoll.TYPE_ANALOG, state=MotionPoll.STATE_FINISHED, + entitled_users_at_stop=[[{"some": ["important", "data"]}]], ) self.poll.create_options() self.option = self.poll.options.get() @@ -1416,6 +1417,7 @@ class ResetMotionPoll(TestCase): self.assertEqual(poll.votesvalid, None) self.assertEqual(poll.votesinvalid, None) self.assertEqual(poll.votescast, None) + self.assertEqual(poll.entitled_users_at_stop, None) option = poll.options.get() self.assertEqual(option.yes, Decimal("0")) self.assertEqual(option.no, Decimal("0")) @@ -1430,6 +1432,7 @@ class ResetMotionPoll(TestCase): self.assertHttpStatusVerbose(response, status.HTTP_200_OK) poll = MotionPoll.objects.get() self.assertFalse(poll.is_pseudoanonymized) + self.assertEqual(poll.entitled_users_at_stop, None) def test_reset_pseudoanonymous(self): self.poll.type = BasePoll.TYPE_PSEUDOANONYMOUS @@ -1439,6 +1442,7 @@ class ResetMotionPoll(TestCase): self.assertHttpStatusVerbose(response, status.HTTP_200_OK) poll = MotionPoll.objects.get() self.assertTrue(poll.is_pseudoanonymized) + self.assertEqual(poll.entitled_users_at_stop, None) class TestMotionPollWithVoteDelegationAutoupdate(TestCase):