From fcb1b97670f65dcc203f402d4c94070e2b45603d 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'),