moodleou / moodle-qtype_pmatch

Pattern-match question type for Moodle
12 stars 23 forks source link

Delete Answers #25

Closed jhoopes closed 5 years ago

jhoopes commented 10 years ago

Hello,

I can't seem to delete the answers on a question when I go and edit the question. If i remove the answer, feedback and set the grade to none, then save the question, the question doesn't save that information.

This is within Moodle 2.6

Thanks for your help

timhunt commented 10 years ago

If you turn on debugging (https://docs.moodle.org/26/en/Debugging) are there any error messages.

What does happen?

jhoopes commented 10 years ago

Hi Tim,

there are no error messages. Looking at the code, there is no logic to remove "oldanswers" from the database on the question type. There's code to update/add answers, but the code never removes old answers that no longer exist. The code I looked at was the save_answers function in the questiontype.php file

John

timhunt commented 10 years ago

Right. looks like you have found a genuine bug. We'll look into it.

pgb2 commented 10 years ago

It's a little more subtle. I have a question with 27 matches. Here's what happens when i try to delete some.

Lose Answer 27 - the last and save. Result: success.

Lose Answer 25 - the next to last. Result: success.

Lose Answers 21 and 22. Result: both Answer 23 and Answer 24 now show Rule 26. Ooops!

I'll add it to our tracker.

timhunt commented 5 years ago

This was fixed long ago by commit 775b2c3a79bf942c114d1f933887f9a17ceeea11. Closing this.