Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[MDL-31386] Correctly order answers in a lesson backup

  • Loading branch information...
commit a731d18ce51dd392ca0738420a5f55bb96fbb192 1 parent f6b4ec2
@andrewnicols andrewnicols authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 mod/lesson/backup/moodle2/backup_lesson_stepslib.php
View
9 mod/lesson/backup/moodle2/backup_lesson_stepslib.php
@@ -170,7 +170,14 @@ protected function define_structure() {
FROM {lesson_pages}
WHERE lessonid = ? ORDER BY prevpageid",
array(backup::VAR_PARENTID));
- $answer->set_source_table('lesson_answers', array('pageid' => backup::VAR_PARENTID));
+
+ // We use SQL here as answers must be ordered by id so that the restore gets them in the right order
+ $answer->set_source_sql('
+ SELECT *
+ FROM {lesson_answers}
+ WHERE pageid = :pageid
+ ORDER BY id',
+ array('pageid' => backup::VAR_PARENTID));
// Check if we are also backing up user information
if ($this->get_setting_value('userinfo')) {
Please sign in to comment.
Something went wrong with that request. Please try again.