From 499636fcc06dd8ec41eddbd881bb6f09be6fc3b9 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Fri, 9 May 2014 12:08:36 +1200 Subject: [PATCH] CONTRIB-4052 Prevent gradebook entry from being added when using nograde --- preferences.php | 4 +++- sessions.php | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/preferences.php b/preferences.php index 37b8128..8597fdd 100644 --- a/preferences.php +++ b/preferences.php @@ -93,7 +93,9 @@ switch ($att->pageparams->action) { foreach ($acronym as $id => $v) { $att->update_status($id, $acronym[$id], $description[$id], $grade[$id], null); } - att_update_all_users_grades($att->id, $att->course, $att->context, $cm); + if ($att->grade > 0) { + att_update_all_users_grades($att->id, $att->course, $att->context, $cm); + } break; } diff --git a/sessions.php b/sessions.php index b32e087..b03b3df 100644 --- a/sessions.php +++ b/sessions.php @@ -85,7 +85,9 @@ switch ($att->pageparams->action) { if (isset($confirm) && confirm_sesskey()) { $att->delete_sessions(array($sessionid)); - att_update_all_users_grades($att->id, $att->course, $att->context, $cm); + if ($att->grade > 0) { + att_update_all_users_grades($att->id, $att->course, $att->context, $cm); + } redirect($att->url_manage(), get_string('sessiondeleted', 'attendance')); } @@ -112,7 +114,9 @@ switch ($att->pageparams->action) { $sessionsids = explode('_', $sessionsids); $att->delete_sessions($sessionsids); - att_update_all_users_grades($att->id, $att->course, $att->context, $cm); + if ($att->grade > 0) { + att_update_all_users_grades($att->id, $att->course, $att->context, $cm); + } redirect($att->url_manage(), get_string('sessiondeleted', 'attendance')); } $sessid = required_param('sessid', PARAM_SEQUENCE);