catalyst / moodle-MDL-70329

GNU General Public License v3.0
5 stars 4 forks source link

Implement question regrade for question versions #438

Open safatshahin opened 2 years ago

safatshahin commented 2 years ago

https://tracker.moodle.org/browse/MDL-72890

Question regrade using dry dun or a selected one could be done previously. But now, editing a question or changing a question creates a new version of that question. On the other hand, the attempt is connected to the previous question id.

We need to change the dry run to work with the latest attempt or even an enhanced UI with some selection around it.

Well, the re-grading system has built into it a chance for the teacher to do a 'Dry run' and see what effect that has on the scores. That does all the calculations, but does not update the database. If that works, then they can re-do the regrade saving the changes.

Actually, doing this is not hard. In question/engine/questionusage.php there is a regrade_question method. I think we need to:

1) Add a new optional argument $newquestion = null (or similar name) 2) if that is passed, when making the new question_attempt, use $newquestion instead of $oldqa->get_question(false). 3) write unit tests! 4) In question/engine/datalib.php, change update_question_attempt to also update $record->questionid.