From: Neill Magill Date: Mon, 9 Nov 2015 16:18:04 +0000 (+0000) Subject: Expired enrolments can prevent student self-attendance X-Git-Url: https://git.cameron1729.xyz/?a=commitdiff_plain;h=989321fa3d0b843bbeebf7e4eec437fa68459794;p=moodle-mod_attendance.git Expired enrolments can prevent student self-attendance ...even when their is another enrolemnt that means they are still active on the course. This fixes issue #178 and is similar to issue #81 --- diff --git a/locallib.php b/locallib.php index 34efe76..e106f89 100644 --- a/locallib.php +++ b/locallib.php @@ -1042,7 +1042,7 @@ class attendance { // CONTRIB-4868 $mintime = 'MIN(CASE WHEN (ue.timestart > :zerotime) THEN ue.timestart ELSE ue.timecreated END)'; - $maxtime = 'MAX(ue.timeend)'; + $maxtime = 'CASE WHEN MIN(ue.timeend) = 0 THEN 0 ELSE MAX(ue.timeend) END'; $sql = "SELECT ue.userid, ue.status, $mintime AS mintime,