MDL-58900 mod_assign: fix incorrect overrides ordering
authorSimey Lameze <simey@moodle.com>
Wed, 24 May 2017 06:17:51 +0000 (14:17 +0800)
committerSimey Lameze <simey@moodle.com>
Wed, 31 May 2017 02:50:28 +0000 (10:50 +0800)
mod/assign/overrideedit.php

index 24af320..fd5ca49 100644 (file)
@@ -183,7 +183,7 @@ if ($mform->is_cancelled()) {
         unset($fromform->id);
         $fromform->id = $DB->insert_record('assign_overrides', $fromform);
         if ($groupmode) {
-            $fromform->sortorder = $fromform->id;
+            $fromform->sortorder = 1;
 
             $overridecountgroup = $DB->count_records('assign_overrides',
                 array('userid' => null, 'assignid' => $assigninstance->id));
@@ -196,7 +196,7 @@ if ($mform->is_cancelled()) {
             }
 
             $DB->update_record('assign_overrides', $fromform);
-
+            reorder_group_overrides($assigninstance->id);
         }
 
         // Determine which override created event to fire.