Skip to content

[vote] Support multiple delegations#3683

Open
vkrasnovyd wants to merge 8 commits into
OpenSlides:feature/votefrom
vkrasnovyd:multi_delegation
Open

[vote] Support multiple delegations#3683
vkrasnovyd wants to merge 8 commits into
OpenSlides:feature/votefrom
vkrasnovyd:multi_delegation

Conversation

@vkrasnovyd

@vkrasnovyd vkrasnovyd commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Adjusts backend to changes in meta: OpenSlides/openslides-meta#547
Original issue: OpenSlides/openslides-vote-service#553

return result

def cleanup_delegations(self, delegatees_to_remove: list[int]) -> None:
"""Remove delegations to ranked_others to ensure correct validation"""

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required so MeetingUserMixin has correct number of delegated votes for max_amount_error_user_ids checks.

Comment thread openslides_backend/action/actions/meeting_user/history_mixin.py Outdated
Comment thread openslides_backend/action/actions/meeting_user/mixin.py Outdated
Comment thread tests/system/action/meeting_user/test_set_data_delegation.py
Co-authored-by: luisa-beerboom <101706784+luisa-beerboom@users.noreply.github.com>
)

if instance["vote_delegated_to_id"]:
vote_delegated_to_ids = instance["vote_delegated_to_ids"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do

Suggested change
vote_delegated_to_ids = instance["vote_delegated_to_ids"]
vote_delegated_to_ids: list[int] = instance["vote_delegated_to_ids"]

and move it at the beginning of the method, you can also replace your instance.get("vote_delegated_to_ids", []) in the if condition.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines +474 to +496
def test_receive_delegations_from_2_users_1_request_ok(self) -> None:
self.set_models({"meeting_user/12": {"vote_delegated_to_ids": None}})
response = self.request_multi(
"meeting_user.set_data",
[
{
"id": 12,
"vote_delegations_from_ids": [13],
},
{
"id": 12,
"vote_delegations_from_ids": [11],
},
],
)
self.assert_status_code(response, 200)
self.assert_model_exists(
"meeting_user/12", {"vote_delegations_from_ids": [11, 13]}
)
for id_ in [11, 13]:
self.assert_model_exists(
f"meeting_user/{id_}", {"vote_delegated_to_ids": [12]}
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also a test for what happens the other way around?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 2 for direct delegation: with redelegation and adding a new delegation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants