Merge pull request #5316 from jsangmeister/voting-autoupdate-fix
Fixes the voting autoupdate bug
This commit is contained in:
commit
ad4ed3443a
@ -156,6 +156,7 @@ class BasePollViewSet(ModelViewSet):
|
|||||||
|
|
||||||
poll.state = BasePoll.STATE_PUBLISHED
|
poll.state = BasePoll.STATE_PUBLISHED
|
||||||
poll.save()
|
poll.save()
|
||||||
|
inform_changed_data(vote.user for vote in poll.get_votes().all() if vote.user)
|
||||||
inform_changed_data(poll.get_votes())
|
inform_changed_data(poll.get_votes())
|
||||||
inform_changed_data(poll.get_options())
|
inform_changed_data(poll.get_options())
|
||||||
return Response()
|
return Response()
|
||||||
|
@ -1979,52 +1979,57 @@ class VoteAssignmentPollNamedAutoupdates(VoteAssignmentPollAutoupdatesBaseClass)
|
|||||||
self.assertAutoupdate(poll, user=user)
|
self.assertAutoupdate(poll, user=user)
|
||||||
autoupdate = self.get_last_autoupdate(user=user)
|
autoupdate = self.get_last_autoupdate(user=user)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
autoupdate[0],
|
autoupdate[0]["assignments/assignment-poll:1"],
|
||||||
{
|
{
|
||||||
"assignments/assignment-poll:1": {
|
"allow_multiple_votes_per_candidate": False,
|
||||||
"allow_multiple_votes_per_candidate": False,
|
"amount_global_abstain": None,
|
||||||
"amount_global_abstain": None,
|
"amount_global_no": None,
|
||||||
"amount_global_no": None,
|
"assignment_id": 1,
|
||||||
"assignment_id": 1,
|
"description": "test_description_paiquei5ahpie1wu8ohW",
|
||||||
"description": "test_description_paiquei5ahpie1wu8ohW",
|
"global_abstain": True,
|
||||||
"global_abstain": True,
|
"global_no": True,
|
||||||
"global_no": True,
|
"groups_id": [GROUP_DELEGATE_PK],
|
||||||
"groups_id": [GROUP_DELEGATE_PK],
|
"id": 1,
|
||||||
"id": 1,
|
"majority_method": "two_thirds",
|
||||||
"majority_method": "two_thirds",
|
"onehundred_percent_base": "cast",
|
||||||
"onehundred_percent_base": "cast",
|
"options_id": [1],
|
||||||
"options_id": [1],
|
"pollmethod": "YNA",
|
||||||
"pollmethod": "YNA",
|
"state": 4,
|
||||||
"state": 4,
|
"title": self.poll.title,
|
||||||
"title": self.poll.title,
|
"type": "named",
|
||||||
"type": "named",
|
"votes_amount": 1,
|
||||||
"votes_amount": 1,
|
"votescast": "1.000000",
|
||||||
"votescast": "1.000000",
|
"votesinvalid": "0.000000",
|
||||||
"votesinvalid": "0.000000",
|
"votesvalid": "1.000000",
|
||||||
"votesvalid": "1.000000",
|
"user_has_voted": user == self.user,
|
||||||
"user_has_voted": user == self.user,
|
"voted_id": [self.user.id],
|
||||||
"voted_id": [self.user.id],
|
|
||||||
},
|
|
||||||
"assignments/assignment-vote:1": {
|
|
||||||
"pollstate": AssignmentPoll.STATE_PUBLISHED,
|
|
||||||
"id": 1,
|
|
||||||
"weight": "1.000000",
|
|
||||||
"value": "A",
|
|
||||||
"user_id": 3,
|
|
||||||
"option_id": 1,
|
|
||||||
},
|
|
||||||
"assignments/assignment-option:1": {
|
|
||||||
"abstain": "1.000000",
|
|
||||||
"id": 1,
|
|
||||||
"no": "0.000000",
|
|
||||||
"poll_id": 1,
|
|
||||||
"pollstate": AssignmentPoll.STATE_PUBLISHED,
|
|
||||||
"yes": "0.000000",
|
|
||||||
"user_id": 1,
|
|
||||||
"weight": 1,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
autoupdate[0]["assignments/assignment-vote:1"],
|
||||||
|
{
|
||||||
|
"pollstate": AssignmentPoll.STATE_PUBLISHED,
|
||||||
|
"id": 1,
|
||||||
|
"weight": "1.000000",
|
||||||
|
"value": "A",
|
||||||
|
"user_id": 3,
|
||||||
|
"option_id": 1,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
autoupdate[0]["assignments/assignment-option:1"],
|
||||||
|
{
|
||||||
|
"abstain": "1.000000",
|
||||||
|
"id": 1,
|
||||||
|
"no": "0.000000",
|
||||||
|
"poll_id": 1,
|
||||||
|
"pollstate": AssignmentPoll.STATE_PUBLISHED,
|
||||||
|
"yes": "0.000000",
|
||||||
|
"user_id": 1,
|
||||||
|
"weight": 1,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
self.assertIn("users/user:3", autoupdate[0])
|
||||||
|
|
||||||
|
|
||||||
class VoteAssignmentPollPseudoanonymousAutoupdates(
|
class VoteAssignmentPollPseudoanonymousAutoupdates(
|
||||||
|
Loading…
Reference in New Issue
Block a user