Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent vote weight of 0 #1938

Merged
merged 2 commits into from
Nov 3, 2023

Conversation

jsangmeister
Copy link
Contributor

fixes #1926

also some cleanup of the models validator

@@ -216,6 +216,8 @@ def get_schema(self) -> Schema:
schema = self.extend_schema(super().get_schema(), **decimal_schema)
if not self.required:
schema["type"] = ["string", "null"]
# remove minimum since it is checked in the validate method
schema.pop("minimum", None)
Copy link
Member

Choose a reason for hiding this comment

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

IMO the minimum value is added to be checked!??? Why this should be removed?
Maybe the check has to be suppressed in case of a non required decimal. But not required with minimum value seems curious IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As the comment states, the minimum is checked manually in the validate method right below that. jsonschema is not capable of handling decimals as string, therefore this has to be done manually and the minimum constraint has to be removed from the schema.

@r-peschke r-peschke assigned jsangmeister and unassigned r-peschke Nov 3, 2023
@jsangmeister jsangmeister merged commit d75a56b into OpenSlides:main Nov 3, 2023
4 checks passed
@jsangmeister jsangmeister deleted the prevent-0-vote-weight branch November 3, 2023 09:31
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.

Prevent vote weight of 0
2 participants