course completion: MDL-22797 Review course completion compatibility with new enrol...
authorAaron Barnes <aaronb@catalyst.net.nz>
Tue, 3 Aug 2010 00:15:55 +0000 (00:15 +0000)
committerAaron Barnes <aaronb@catalyst.net.nz>
Tue, 3 Aug 2010 00:15:55 +0000 (00:15 +0000)
Thanks to Iver Johnson for the patch

Also fixes MDL-23595

lib/completion/completion_criteria_duration.php
lib/completion/cron.php

index 7a42909..96847ec 100644 (file)
@@ -186,8 +186,8 @@ class completion_criteria_duration extends completion_criteria {
                 u.id AS userid,
                 ue.timestart AS otimestart,
                 (ue.timestart + cr.enrolperiod) AS ctimestart,
-                ue.timeenrolled AS otimeenrolled,
-                (ue.timeenrolled + cr.enrolperiod) AS ctimeenrolled
+                ue.timecreated AS otimeenrolled,
+                (ue.timecreated + cr.enrolperiod) AS ctimeenrolled
             FROM
                 {user} u
             INNER JOIN
@@ -213,7 +213,7 @@ class completion_criteria_duration extends completion_criteria {
             AND
             (
                 ue.timestart > 0 AND ue.timestart + cr.enrolperiod < ?
-             OR ue.timeenrolled > 0 AND ue.timeenrolled + cr.enrolperiod < ?
+             OR ue.timecreated > 0 AND ue.timecreated + cr.enrolperiod < ?
             )
         ';
 
index a216151..b0e3f86 100644 (file)
@@ -78,7 +78,7 @@ function completion_cron_mark_started() {
             u.id AS userid,
             crc.id AS completionid,
             ue.timestart,
-            ue.timeenrolled
+            ue.timecreated
         FROM
             {user} u
         INNER JOIN
@@ -102,8 +102,8 @@ function completion_cron_mark_started() {
         AND u.deleted = 0
         AND ue.timestart < ?
         AND (ue.timeend > ? OR ue.timeend = 0)
-        AND ue.timeenrolled < ?
-        AND (ue.timeenrolled > ? OR ue.timeenrolled = 0)
+        AND ue.timecreated < ?
+        AND (ue.timecreated > ? OR ue.timecreated = 0)
         ORDER BY
             course,
             userid