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

Add max per option validator and onkeyon for votes input fields #4492

Merged

Conversation

reiterl
Copy link
Member

@reiterl reiterl commented Dec 18, 2024

Resolve #4453

The on change is still needed, for mouse updates.
The on key up checks without focus lose.
@reiterl reiterl added the bug label Dec 18, 2024
@reiterl reiterl added this to the 4.3 milestone Dec 18, 2024
@@ -1,11 +1,11 @@
import { AbstractControl, ValidatorFn } from '@angular/forms';

export function isNumberRange(minCtrlName: string, maxCtrlName: string): ValidatorFn {
export function isNumberRange(minCtrlName: string, maxCtrlName: string, errorName: string): ValidatorFn {
Copy link
Member

Choose a reason for hiding this comment

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

Might be a good idea to set a default value for that.

Suggested change
export function isNumberRange(minCtrlName: string, maxCtrlName: string, errorName: string): ValidatorFn {
export function isNumberRange(minCtrlName: string, maxCtrlName: string, errorName: string = `rangeError`): ValidatorFn {

Copy link
Member Author

Choose a reason for hiding this comment

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

Add a default to the validator and use default where possible.

@reiterl reiterl requested a review from bastianjoel December 19, 2024 09:48
@bastianjoel bastianjoel removed their assignment Dec 19, 2024
Copy link
Member

@Elblinator Elblinator left a comment

Choose a reason for hiding this comment

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

The min-votes are now in warn-colour if the two other amounts are wrong, they should not be in warn colour
Screenshot_20250106_154204

If Yes as voting method was selected and then max per option is bigger max per vote and then another voting method is selected then you cannot save the balloot
Screenshot_20250106_154107

@Elblinator Elblinator assigned bastianjoel and unassigned Elblinator Jan 6, 2025
@reiterl
Copy link
Member Author

reiterl commented Jan 7, 2025

As min-votes, max-votes and max-votes-per option is one form group it is not easy possible to have the validator on just two of the fields.

@Elblinator Elblinator assigned reiterl and unassigned bastianjoel Jan 7, 2025
@reiterl
Copy link
Member Author

reiterl commented Jan 7, 2025

Add a fix for the problem with setting to 'N' method.

Copy link
Member

@Elblinator Elblinator left a comment

Choose a reason for hiding this comment

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

function

both described things are fixed

@Elblinator Elblinator removed their assignment Jan 7, 2025
@bastianjoel bastianjoel merged commit a849a38 into OpenSlides:main Jan 10, 2025
4 checks passed
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.

Elections: two issues in cumulative voting
3 participants