Merge branch 'MDL-53111_m32v1' of https://github.com/sbourget/moodle
authorAndrew Nicols <andrew@nicols.co.uk>
Mon, 27 Jun 2016 05:30:51 +0000 (13:30 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Mon, 27 Jun 2016 05:30:51 +0000 (13:30 +0800)
mod/lesson/mod_form.php

index 44b1e14..f0fa12e 100644 (file)
@@ -426,6 +426,12 @@ class mod_lesson_mod_form extends moodleform_mod {
                 $data->completiontimespent = 0;
             }
         }
+        if (!empty($data->completionunlocked)) {
+            $autocompletion = !empty($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
+            if (empty($data->completionendreached) || !$autocompletion) {
+                $data->completionendreached = 0;
+            }
+        }
         return $data;
     }
 }