From af5a743a2bcf359ec9ae867f33329ab4ff370638 Mon Sep 17 00:00:00 2001 From: Neill Magill Date: Mon, 9 Nov 2015 16:18:04 +0000 Subject: [PATCH] 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 --- locallib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locallib.php b/locallib.php index d0af022..5f4306d 100644 --- a/locallib.php +++ b/locallib.php @@ -1166,7 +1166,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,