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

require options to be unique within same poll #181

Closed
wjk36 opened this issue Aug 14, 2022 · 3 comments · Fixed by #188
Closed

require options to be unique within same poll #181

wjk36 opened this issue Aug 14, 2022 · 3 comments · Fixed by #188
Assignees
Labels
bug Something isn't working done assigned after closing issue good first issue Good for newcomers typescript Probably needs Typescript-related skills
Milestone

Comments

@wjk36
Copy link

wjk36 commented Aug 14, 2022

Currently user can enter the same option twice for the same poll. Maybe display a warning and disable 'ready' button when two options are non-unique.

Screen Shot 2022-08-13 at 8 14 50 PM

@mensch72 mensch72 added bug Something isn't working good first issue Good for newcomers ready to implement Sufficiently detailed to start working on --> place in "Issues" typescript Probably needs Typescript-related skills labels Aug 15, 2022
@mensch72 mensch72 added this to the First Release milestone Aug 15, 2022
@mensch72 mensch72 added this to To do in towards the First Stable Release via automation Aug 15, 2022
@mensch72
Copy link
Collaborator

Thank you @wjk36, this is an obvious bug I should have seen earlier!
To fix it, we need to add another validator in the respective forms in the draftpoll and addoption-dialog components, plus corresponding error messages.

@semla
Copy link
Contributor

semla commented Sep 17, 2022

It is a start; added a custom validator, in its own file since it should be used in the addoption-dialog too. But haven't wrapped my head around that component, when is it used?

Other opinions?

Edit: saw that the addoption-dialog is for adding options after the poll has started. Unfortunately this component seems to not know about the added options array.

@mensch72 mensch72 added the in progress Work on this has started but is not yet ready for review label Sep 17, 2022
towards the First Stable Release automation moved this from To do to Done Sep 20, 2022
@mensch72
Copy link
Collaborator

I managed to add the validator also to addoption-dialog now, using: unique_name_validator$(of(this.p.oids.map(oid => this.p.options[oid].name)))

@mensch72 mensch72 added done assigned after closing issue and removed ready to implement Sufficiently detailed to start working on --> place in "Issues" in progress Work on this has started but is not yet ready for review labels Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working done assigned after closing issue good first issue Good for newcomers typescript Probably needs Typescript-related skills
Development

Successfully merging a pull request may close this issue.

3 participants