If question attempts have answers recorded, but they are the "needsgrading" state, which function(s) need to be called to get them graded? Or should they be graded at the time that answers are saved?
Background:
I am updating the papercopy module to work with Using Moodle 2.8, and making some improvements. The module follows roughly this series of steps:
$usage = question_engine::make_questions_usage_by_activity
foreach($quiz_questions
$usage->add_question($question);
}
...
//enter the student's answers for each of the questions
foreach($slotsas$slot){
$usage->process_action($slot, array('answer' =>$set['Question'.$slot]-1));
}
...
question_engine::save_questions_usage_by_activity($usage);
$attempt=newstdClass();
$attempt->quiz =$this->quiz->id; ...
$attempt_object=new quiz_attempt($attempt, $this->quiz, $this->cm, $this->course, true);
$attempt_object->process_finish(time(), true);
The full code is here:
https://github.com/MorrisR2/moodle-quiz_papercopy/blob/create_user_if_not_exist/report.php
What we end up with is a quiz attempt shows in the reports, and clicking on "Review attempt" shows which answers were selected for the questions, but the questions are as-yet ungraded. The "state" of the question attempts == $needsgrading. What needs to be done to have the questions / quiz graded?