From 4b68c7414036f06e5d41e52f0d08cbe99a7d9feb Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Fri, 26 Jan 2018 10:07:33 +1300 Subject: [PATCH] Put magic number into constant. --- classes/add_warning_form.php | 2 +- locallib.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/classes/add_warning_form.php b/classes/add_warning_form.php index c21ad5e..0b9c238 100644 --- a/classes/add_warning_form.php +++ b/classes/add_warning_form.php @@ -52,7 +52,7 @@ class mod_attendance_add_warning_form extends moodleform { $mform->setDefault('warningpercent', $config->warningpercent); $options = array(); - for ($i = 1; $i <= 50; $i++) { + for ($i = 1; $i <= ATTENDANCE_MAXWARNAFTER; $i++) { $options[$i] = "$i"; } $mform->addElement('select', 'warnafter', get_string('warnafter', 'mod_attendance'), $options); diff --git a/locallib.php b/locallib.php index b364d86..efa2405 100644 --- a/locallib.php +++ b/locallib.php @@ -43,6 +43,9 @@ define('ATTENDANCE_AUTOMARK_DISABLED', 0); define('ATTENDANCE_AUTOMARK_ALL', 1); define('ATTENDANCE_AUTOMARK_CLOSE', 2); +// Max number of sessions available in the warnings set form to trigger warnings. +define('ATTENDANCE_MAXWARNAFTER', 100); + /** * Get statuses, *