From 142fc543cca4783f9c868e64bd74e47459fb4db9 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Mon, 22 May 2017 14:31:39 +1200 Subject: [PATCH] when course reset, reset automarkcompleted just in case. --- lib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib.php b/lib.php index 20416d2..cae35bb 100644 --- a/lib.php +++ b/lib.php @@ -190,6 +190,10 @@ function attendance_reset_userdata($data) { $DB->delete_records_select('attendance_log', "sessionid $sql", $params); list($sql, $params) = $DB->get_in_or_equal($attids); $DB->set_field_select('attendance_sessions', 'lasttaken', 0, "attendanceid $sql", $params); + if (empty($data->reset_attendance_sessions)) { + // If sessions are being retained, clear automarkcompleted value. + $DB->set_field_select('attendance_sessions', 'automarkcompleted', 0, "attendanceid $sql", $params); + } $status[] = array( 'component' => get_string('modulenameplural', 'attendance'),