mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
questionlib: MDL-21828 Fix database query that does not work in Oracle.
Bug report and fix thanks to David Binney.
This commit is contained in:
parent
1150c1bdba
commit
59be14de39
1 changed files with 8 additions and 3 deletions
|
@ -1033,7 +1033,9 @@ function question_preload_states($attemptid) {
|
||||||
|
|
||||||
// The questionid field must be listed first so that it is used as the
|
// The questionid field must be listed first so that it is used as the
|
||||||
// array index in the array returned by $DB->get_records_sql
|
// array index in the array returned by $DB->get_records_sql
|
||||||
$statefields = 'n.questionid as question, s.*, n.sumpenalty, n.manualcomment, n.flagged, n.id as questionsessionid';
|
$statefields = 'n.questionid as question, s.id, s.attempt, ' .
|
||||||
|
's.seq_number, s.answer, s.timestamp, s.event, s.grade, s.raw_grade, ' .
|
||||||
|
's.penalty, n.sumpenalty, n.manualcomment, n.flagged, n.id as questionsessionid';
|
||||||
|
|
||||||
// Load the newest states for the questions
|
// Load the newest states for the questions
|
||||||
$sql = "SELECT $statefields
|
$sql = "SELECT $statefields
|
||||||
|
@ -1101,8 +1103,11 @@ function question_load_states(&$questions, &$states, $cmoptions, $attempt, $last
|
||||||
// If the new attempt is to be based on this previous attempt.
|
// If the new attempt is to be based on this previous attempt.
|
||||||
// Find the responses from the previous attempt and save them to the new session
|
// Find the responses from the previous attempt and save them to the new session
|
||||||
|
|
||||||
// Load the last graded state for the question
|
// Load the last graded state for the question. Note, $statefields is
|
||||||
$statefields = 'n.questionid as question, s.*, n.sumpenalty';
|
// the same as above, except that we don't want n.manualcomment.
|
||||||
|
$statefields = 'n.questionid as question, s.id, s.attempt, ' .
|
||||||
|
's.seq_number, s.answer, s.timestamp, s.event, s.grade, s.raw_grade, ' .
|
||||||
|
's.penalty, 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.newest
|
WHERE s.id = n.newest
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue