Skip to content

Delete poll with vote adapter#3590

Open
vkrasnovyd wants to merge 10 commits into
OpenSlides:feature/votefrom
vkrasnovyd:delete-poll-with-vote-adapter
Open

Delete poll with vote adapter#3590
vkrasnovyd wants to merge 10 commits into
OpenSlides:feature/votefrom
vkrasnovyd:delete-poll-with-vote-adapter

Conversation

@vkrasnovyd
Copy link
Copy Markdown
Contributor

@vkrasnovyd vkrasnovyd marked this pull request as draft May 21, 2026 15:14
@vkrasnovyd vkrasnovyd force-pushed the delete-poll-with-vote-adapter branch from 8bc64bf to 7214f77 Compare May 21, 2026 15:30
@vkrasnovyd vkrasnovyd marked this pull request as ready for review May 21, 2026 16:40
@vkrasnovyd vkrasnovyd requested a review from luisa-beerboom May 21, 2026 16:41
Copy link
Copy Markdown
Member

@luisa-beerboom luisa-beerboom left a comment

Choose a reason for hiding this comment

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

From my understanding this isn't done, which is why I won't complain about the user_merge test yet.

def make_request(
self,
endpoint: str,
request_method: Literal["post", "delete"],
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.

How about turning this into a type or StrEnum?

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.

Good idea. Added REQUEST_METHOD type with currently only 2 methods that are being used in the code.

instance = datastore.get(
config_fqid,
list(get_fields_for_export(collection)),
config_ids = [poll.get("config_id") for poll in polls.values()]
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 are going to move this outside the if-clause, you might want to ensure polls is set by adding a default, or move this back

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.

Reverted this part. Was part of some work in progress changes that don't even belong here.

config_ids = [poll.get("config_id") for poll in polls.values()]

for config_fqid in config_ids:
collection, id_ = config_fqid.split("/")
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.

I can see that this is not your code so this is just a suggestion, but you could use collection_and_id_from_fqid here

@vkrasnovyd
Copy link
Copy Markdown
Contributor Author

From my understanding this isn't done, which is why I won't complain about the user_merge test yet.

user_merge needs to be discussed and more seriously updated because of the changes that have happened in the collections. I will handle user_merge and tests for it separately.

@vkrasnovyd vkrasnovyd requested a review from luisa-beerboom May 22, 2026 12:21
@vkrasnovyd vkrasnovyd force-pushed the delete-poll-with-vote-adapter branch from d51a325 to 2456925 Compare May 29, 2026 08:55
self,
endpoint: str,
request_method: Literal["post", "delete"],
request_method: Literal[REQUEST_METHOD.POST, REQUEST_METHOD.DELETE],
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.

Can't you just write request_method: REQUEST_METHOD,?

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.

Doing this with the StrEnum-class shared for all the services seems to be not safe to me (in case we ever have to update it). As we didn't need it for other services, moved it to the file with VoteAdapter and made the suggested change.

from enum import StrEnum


class REQUEST_METHOD(StrEnum):
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.

I think RequestMethod may be a better name. We don't usually fully capitalize StrEnums.

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.

@vkrasnovyd vkrasnovyd requested a review from luisa-beerboom May 29, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants