mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
Merge branch 'MDL-28128' of git://github.com/timhunt/moodle
This commit is contained in:
commit
a80d6ab536
2 changed files with 199 additions and 2 deletions
|
@ -67,7 +67,7 @@ class question_engine_attempt_upgrader {
|
|||
gc_collect_cycles(); // This was really helpful in PHP 5.2. Perhaps remove.
|
||||
$a = new stdClass();
|
||||
$a->done = $done;
|
||||
$a->todo = $outof;
|
||||
$a->outof = $outof;
|
||||
$a->info = $quizid;
|
||||
$this->progressbar->update($done, $outof, get_string('upgradingquizattempts', 'quiz', $a));
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ class question_engine_attempt_upgrader {
|
|||
}
|
||||
|
||||
// Add the new state to the array, and advance.
|
||||
$qstates[$state->seq_number] = $state;
|
||||
$qstates[] = $state;
|
||||
$questionsstatesrs->next();
|
||||
}
|
||||
|
||||
|
|
|
@ -962,6 +962,203 @@ class qtype_truefalse_attempt_upgrader_test extends question_attempt_upgrader_te
|
|||
),
|
||||
);
|
||||
|
||||
$this->compare_qas($expectedqa, $qa);
|
||||
}
|
||||
|
||||
public function test_truefalse_adaptive_qsession3() {
|
||||
$quiz = (object) array(
|
||||
'id' => '1',
|
||||
'course' => '2',
|
||||
'name' => 'Test Quiz',
|
||||
'intro' => '',
|
||||
'introformat' => '1',
|
||||
'timeopen' => '0',
|
||||
'timeclose' => '0',
|
||||
'preferredbehaviour' => 'adaptive',
|
||||
'attempts' => '0',
|
||||
'attemptonlast' => '0',
|
||||
'grademethod' => '1',
|
||||
'decimalpoints' => '2',
|
||||
'questiondecimalpoints' => '-1',
|
||||
'reviewattempt' => '69888',
|
||||
'reviewcorrectness' => '69888',
|
||||
'reviewmarks' => '69888',
|
||||
'reviewspecificfeedback' => '69888',
|
||||
'reviewgeneralfeedback' => '69888',
|
||||
'reviewrightanswer' => '69888',
|
||||
'reviewoverallfeedback' => '4352',
|
||||
'questionsperpage' => '1',
|
||||
'shufflequestions' => '0',
|
||||
'shuffleanswers' => '1',
|
||||
'questions' => '1,0',
|
||||
'sumgrades' => '1.00000',
|
||||
'grade' => '10.00000',
|
||||
'timecreated' => '0',
|
||||
'timemodified' => '1309441728',
|
||||
'timelimit' => '0',
|
||||
'password' => '',
|
||||
'subnet' => '',
|
||||
'popup' => '0',
|
||||
'delay1' => '0',
|
||||
'delay2' => '0',
|
||||
'showuserpicture' => '0',
|
||||
'showblocks' => '0',
|
||||
);
|
||||
$attempt = (object) array(
|
||||
'id' => '3',
|
||||
'uniqueid' => '3',
|
||||
'quiz' => '1',
|
||||
'userid' => '4',
|
||||
'attempt' => '2',
|
||||
'sumgrades' => null,
|
||||
'timestart' => '1309441460',
|
||||
'timefinish' => '1309441471',
|
||||
'timemodified' => '1309441969',
|
||||
'layout' => '1,0',
|
||||
'preview' => '0',
|
||||
'needsupgradetonewqe' => 1,
|
||||
);
|
||||
$question = (object) array(
|
||||
'id' => '1',
|
||||
'category' => '2',
|
||||
'parent' => '0',
|
||||
'name' => 'Does 1 + 1 = 2?',
|
||||
'questiontext' => '',
|
||||
'questiontextformat' => '1',
|
||||
'generalfeedback' => '',
|
||||
'generalfeedbackformat' => '1',
|
||||
'defaultmark' => '1.0000000',
|
||||
'penalty' => '1.0000000',
|
||||
'qtype' => 'truefalse',
|
||||
'length' => '1',
|
||||
'stamp' => 'localhost:8888+110630134237+QzfsHZ',
|
||||
'version' => 'localhost:8888+110630134237+IaYGE6',
|
||||
'hidden' => '0',
|
||||
'timecreated' => '1309441357',
|
||||
'timemodified' => '1309441357',
|
||||
'createdby' => '3',
|
||||
'modifiedby' => '3',
|
||||
'maxmark' => '1.0000000',
|
||||
'options' => (object) array(
|
||||
'id' => '1',
|
||||
'question' => '1',
|
||||
'trueanswer' => '1',
|
||||
'falseanswer' => '2',
|
||||
'answers' => array(
|
||||
1 => (object) array(
|
||||
'id' => '1',
|
||||
'question' => '1',
|
||||
'answer' => 'True',
|
||||
'answerformat' => '0',
|
||||
'fraction' => '1.0000000',
|
||||
'feedback' => '',
|
||||
'feedbackformat' => '1',
|
||||
),
|
||||
2 => (object) array(
|
||||
'id' => '2',
|
||||
'question' => '1',
|
||||
'answer' => 'False',
|
||||
'answerformat' => '0',
|
||||
'fraction' => '0.0000000',
|
||||
'feedback' => '',
|
||||
'feedbackformat' => '1',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
$qsession = (object) array(
|
||||
'id' => '3',
|
||||
'attemptid' => '3',
|
||||
'questionid' => '1',
|
||||
'newest' => '7',
|
||||
'newgraded' => '7',
|
||||
'sumpenalty' => '1.0000000',
|
||||
'manualcomment' => '',
|
||||
'manualcommentformat' => '1',
|
||||
'flagged' => '0',
|
||||
);
|
||||
$qstates = array(
|
||||
5 => (object) array(
|
||||
'id' => '5',
|
||||
'attempt' => '3',
|
||||
'question' => '1',
|
||||
'seq_number' => '0',
|
||||
'answer' => '',
|
||||
'timestamp' => '1309441460',
|
||||
'event' => '0',
|
||||
'grade' => '0.0000000',
|
||||
'raw_grade' => '0.0000000',
|
||||
'penalty' => '0.0000000',
|
||||
),
|
||||
6 => (object) array(
|
||||
'id' => '6',
|
||||
'attempt' => '3',
|
||||
'question' => '1',
|
||||
'seq_number' => '1',
|
||||
'answer' => '1',
|
||||
'timestamp' => '1309441463',
|
||||
'event' => '3',
|
||||
'grade' => '1.0000000',
|
||||
'raw_grade' => '1.0000000',
|
||||
'penalty' => '1.0000000',
|
||||
),
|
||||
7 => (object) array(
|
||||
'id' => '7',
|
||||
'attempt' => '3',
|
||||
'question' => '1',
|
||||
'seq_number' => '1',
|
||||
'answer' => '1',
|
||||
'timestamp' => '1309441463',
|
||||
'event' => '6',
|
||||
'grade' => '1.0000000',
|
||||
'raw_grade' => '1.0000000',
|
||||
'penalty' => '1.0000000',
|
||||
),
|
||||
);
|
||||
|
||||
$qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
|
||||
|
||||
$expectedqa = (object) array(
|
||||
'behaviour' => 'adaptive',
|
||||
'questionid' => 1,
|
||||
'variant' => 1,
|
||||
'maxmark' => 1.0000000,
|
||||
'minfraction' => 0,
|
||||
'flagged' => 0,
|
||||
'questionsummary' => '',
|
||||
'rightanswer' => 'True',
|
||||
'responsesummary' => 'True',
|
||||
'timemodified' => 1309441463,
|
||||
'steps' => array(
|
||||
0 => (object) array(
|
||||
'sequencenumber' => 0,
|
||||
'state' => 'todo',
|
||||
'fraction' => null,
|
||||
'timecreated' => 1309441460,
|
||||
'userid' => 4,
|
||||
'data' => array(),
|
||||
),
|
||||
1 => (object) array(
|
||||
'sequencenumber' => 1,
|
||||
'state' => 'complete',
|
||||
'fraction' => 1,
|
||||
'timecreated' => 1309441463,
|
||||
'userid' => 4,
|
||||
'data' => array('answer' => 1, '-submit' => 1,
|
||||
'-_try' => 1, '-_rawfraction' => 1),
|
||||
),
|
||||
2 => (object) array(
|
||||
'sequencenumber' => 2,
|
||||
'state' => 'gradedright',
|
||||
'fraction' => 1,
|
||||
'timecreated' => 1309441463,
|
||||
'userid' => 4,
|
||||
'data' => array('answer' => 1, '-finish' => 1,
|
||||
'-_try' => 1, '-_rawfraction' => 1),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$this->compare_qas($expectedqa, $qa);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue