MDL-61328 tool_usertours: do not fix tour sortorder after step editing
authorMarina Glancy <marina@moodle.com>
Thu, 1 Feb 2018 03:47:18 +0000 (11:47 +0800)
committerMarina Glancy <marina@moodle.com>
Mon, 26 Mar 2018 01:52:14 +0000 (09:52 +0800)
otherwise it breaks when we try to modify the step sortorder

admin/tool/usertours/classes/step.php

index 6049e8f..4819ac0 100644 (file)
@@ -483,10 +483,9 @@ class step {
             $record = $this->to_record();
             unset($record->id);
             $this->id = $DB->insert_record('tool_usertours_steps', $record);
+            $this->get_tour()->reset_step_sortorder();
         }
 
-        $this->get_tour()->reset_step_sortorder();
-
         $this->reload();
 
         // Notify of a change to the step configuration.