Put magic number into constant.
authorDan Marsden <dan@danmarsden.com>
Thu, 25 Jan 2018 21:07:33 +0000 (10:07 +1300)
committerDan Marsden <dan@danmarsden.com>
Thu, 25 Jan 2018 21:07:33 +0000 (10:07 +1300)
classes/add_warning_form.php
locallib.php

index c21ad5e..0b9c238 100644 (file)
@@ -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);
index b364d86..efa2405 100644 (file)
@@ -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,
  *