Permalink
Browse files

MDL-27394 Moodle 2.0 backup and restore may randomise the order of mu…

…ltichoice/numerical/shortanswer answers
  • Loading branch information...
1 parent 36f0835 commit 8ad8b7dba8f23ba28c269750d53a7937b4fa94cd @timhunt timhunt committed with stronk7 May 5, 2011
@@ -53,7 +53,12 @@ protected function add_question_question_answers($element) {
$answers->add_child($answer);
// Set the sources
- $answer->set_source_table('question_answers', array('question' => backup::VAR_PARENTID));
+ $answer->set_source_sql('
+ SELECT *
+ FROM {question_answers}
+ WHERE question = :question
+ ORDER BY id',
+ array('question' => backup::VAR_PARENTID));
// Aliases
$answer->set_source_alias('answer', 'answertext');
@@ -82,7 +87,12 @@ protected function add_question_numerical_units($element) {
$units->add_child($unit);
// Set the sources
- $unit->set_source_table('question_numerical_units', array('question' => backup::VAR_PARENTID));
+ $unit->set_source_sql('
+ SELECT *
+ FROM {question_numerical_units}
+ WHERE question = :question
+ ORDER BY id',
+ array('question' => backup::VAR_PARENTID));
// don't need to annotate ids nor files
}
@@ -2194,6 +2194,7 @@ protected function add_subplugin_structure($subplugintype, $element) {
/**
* As far as activity restore steps are implementing restore_subplugin stuff, they need to
* have the parent task available for wrapping purposes (get course/context....)
+ * @return restore_task
*/
public function get_task() {
return $this->task;
@@ -58,7 +58,12 @@ protected function define_question_plugin_structure() {
// set source to populate the data
$matchoptions->set_source_table('question_match', array('question' => backup::VAR_PARENTID));
- $match->set_source_table('question_match_sub', array('question' => backup::VAR_PARENTID));
+ $match->set_source_sql('
+ SELECT *
+ FROM {question_match_sub}
+ WHERE question = :question
+ ORDER BY id',
+ array('question' => backup::VAR_PARENTID));
// don't need to annotate ids nor files

0 comments on commit 8ad8b7d

Please sign in to comment.