question state loading MDL-9327 and MDL-19114 fix loading the state of ungraded essay questions

In two situations, the correct state was not being loaded for essay questions that had
not yet been manually graded:
1. When starting a subsequent attempt in each attempt builds on last mode.
2. In the quiz reports.

This commit fixes the problem. It has one other side-effect. When viewing the individual
question grades in the overview report for an attempt that is still in progress, the
information displayed will be slightly different. This only affects adaptive mode quizzes,
and will acutally cause the report to show slighly more up-to-date information.

Interestingly, the reportlib.php change had already been made in HEAD, as part of MDL 16529
This commit is contained in:
Tim Hunt 2010-02-05 16:37:01 +00:00
parent 60e1930096
commit 0b8506ec85

View file

@ -1105,7 +1105,7 @@ function question_load_states(&$questions, &$states, $cmoptions, $attempt, $last
$statefields = 'n.questionid as question, s.*, n.sumpenalty'; $statefields = 'n.questionid as question, s.*, n.sumpenalty';
$sql = "SELECT $statefields $sql = "SELECT $statefields
FROM {question_states} s, {question_sessions} n FROM {question_states} s, {question_sessions} n
WHERE s.id = n.newgraded WHERE s.id = n.newest
AND n.attemptid = ? AND n.attemptid = ?
AND n.questionid = ?"; AND n.questionid = ?";
if (!$laststate = $DB->get_record_sql($sql, array($lastattemptid, $qid))) { if (!$laststate = $DB->get_record_sql($sql, array($lastattemptid, $qid))) {