Hello
When user types a write-in choice of his own, it could happen that this choice already exists in the poll. In this case, advpoll_form_submit() function will both create a new write-in choice and select an existing one, and then it will try to add both existing and new choices as user votes. Of course it will raise an error if maximum choices is set to 1 for this poll, but the new write-in will be added anyway. This way I can add any number of same write-ins to the poll and it would cause pain to poll moderator when he will try to merge or delete these write-ins.
The correct behaviour, as I see it, is to check if the write-in already exists and if it does - to add user vote to the existing choice instead of creating a new one with the same name.
I attached a patch doing just that. It should be noted though, that I didn't test it with every option of the module, only with common 1-choice select-or-write-in polls.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2329021-2.patch | 1.34 KB | heykarthikwithu |
| |||
write-in-duplicate.patch | 1.41 KB | graker | |
Comments
Comment #1
tripper54 CreditAttribution: tripper54 commentedLooks legit, however the patch does not apply due to being rolled in the docroot, and there are a few little code issues.
Patch should be rolled from the module folder, not the site docroot.
Trailing whitespace, No leading space or capitalisation.
No leading space or full stop.
Do we really have to check this twice?
Trailing whitespace.
Comment #2
heykarthikwithuAs per #1.
Comment #3
tripper54 CreditAttribution: tripper54 commentedSee points 2,3,4 & 5 in #1.