Problem/Motivation
Now when a user vote a choice and the you delete this choice leads to an exception showing the results as tries to find the option and it doesn't exist.
Proposed resolution
When deleting a choice if this choice has votes, them has to be deleted too.
Also test that it works with multilanguage #132339: Multilingual poll choices
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | check_deleted_vote_in_db-2648802-12.patch | 1.49 KB | tduong |
| #12 | interdiff-2648802-10-12.txt | 1.3 KB | tduong |
| #7 | interdiff-deleting_a_choice-2648802-2-7.txt | 2.46 KB | edurenye |
| #7 | deleting_a_choice-2648802-7.patch | 3.61 KB | edurenye |
| #3 | deleting_a_choice-2648802-2.patch | 4.13 KB | edurenye |
Comments
Comment #2
edurenye commentedDone and added tests.
Comment #3
edurenye commentedLast was just test, I pressed wrong button.
Comment #5
berdirDo we need this complexity? What about making deleteChoiceVotes() a list of choice ID's? It can write a super-simple, single db delete query to delete them all in one go.
not sure if we need that.
Comment #6
berdirOnce this is in, lets do a follow-up to move all vote related methods from PollStorage to this new service.
Comment #7
edurenye commentedDone.
Comment #9
berdirThanks, committed.
Comment #10
tduong commentedReopening the issue and renaming the title.
I was about to start working on the followup #2648836: Alert the user that deleting a choice will delete the votes on it and after a discussion with @berdir what is missing here is to check that the vote has been actually deleted from the database. I've added this check on the new patch.
Comment #11
berdirThis verifies that the poll *choice* got deleted. That's fine.
But what we're actually after here is that the *vote* for the poll choice got deleted. You need to look at the poll_vote table, with a normal select query, as that's not an entity.
Comment #12
tduong commentedOops, was trying to do something and then forgot to re-fix it...
Now should be the right one.
Comment #14
berdirThanks, committed.
Comment #15
tduong commentedForgot to created follow-up as prompted at comment #6 (?) #2682423: Move all vote related methods from PollStorage to the new poll_vote.storage service