Hi,
I've got the same problem:
Notice: Undefined index: 876 in /home/users/prinqftp/examen.prince2leren.nu/mod/quiz/attemptlib.php on line 412
Notice: Trying to get property of non-object in /home/users/prinqftp/examen.prince2leren.nu/mod/quiz/attemptlib.php on line 412
Notice: Undefined property: stdClass::$id in /home/users/prinqftp/examen.prince2leren.nu/mod/quiz/attemptlib.php on line 1133
Notice: Undefined index: in /home/users/prinqftp/examen.prince2leren.nu/mod/quiz/attemptlib.php on line 686
Notice: Trying to get property of non-object in /home/users/prinqftp/examen.prince2leren.nu/mod/quiz/attemptlib.php on line 687
Notice: Trying to get property of non-object in /home/users/prinqftp/examen.prince2leren.nu/mod/quiz/attemptlib.php on line 709
Debug info: Column 'questionid' cannot be null
INSERT INTO mdl_question_sessions (attemptid,questionid,newest,newgraded,sumpenalty,manualcomment,manualcommentformat,flagged) VALUES(?,?,?,?,?,?,?,?)
[array (
0 => '196',
1 => NULL,
2 => 18070,
3 => 18070,
4 => '0.0000000',
5 => '',
6 => '1',
7 => 0,
)]
Stack trace:
- line 394 of /lib/dml/moodle_database.php: dml_write_exception thrown
- line 874 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
- line 916 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
- line 1353 of /lib/questionlib.php: call to mysqli_native_moodle_database->insert_record()
- line 166 of /mod/quiz/processattempt.php: call to save_question_session()
I checked the DB:
SELECT DISTINCT event
FROM mdl_question_states
LIMIT 0 , 30
Results are : 0, 6, 3, 2
Your propose workaround:
I changed the code to:
public function get_question_status($questionid) {
$state = $this->states[$questionid];
switch ($state->event) {
case QUESTION_EVENTOPEN:
return 'open';
case QUESTION_EVENTSAVE:
case QUESTION_EVENTGRADE:
case QUESTION_EVENTSUBMIT:
return 'answered';
case QUESTION_EVENTCLOSEANDGRADE:
case QUESTION_EVENTCLOSE:
case QUESTION_EVENTMANUALGRADE:
$options = $this->get_render_options($questionid);
if ($options->scores && $this->questions[$questionid]->maxgrade > 0) {
return question_get_feedback_class($state->last_graded->raw_grade /
$this->questions[$questionid]->maxgrade);
} else {
return 'closed';
}
default:
return 'unknown';// WORKAROUND nav Mustafa probleem MN 30-06-2011
$a = new stdClass;
$a->event = $state->event;
$a->questionid = $questionid;
$a->attemptid = $this->attempt->id;
throw new moodle_quiz_exception($this, 'errorunexpectedevent', $a);
}
}
I flushed the buffers, logged in through another account, but the problem still is there!
Mart van der Niet