Browse Source

Allow status with no availability value set to be included in auto-marking.

40-behatfixes
Dan Marsden 3 years ago
parent
commit
5502f623c2
  1. 13
      classes/structure.php
  2. 10
      db/upgrade.php
  3. 2
      lang/en/attendance.php
  4. 4
      settings.php
  5. 4
      version.php

13
classes/structure.php

@ -1309,9 +1309,16 @@ class mod_attendance_structure {
} }
} else { } else {
foreach ($statuses as $status) { foreach ($statuses as $status) {
if ($status->studentavailability !== '0' && if ($status->studentavailability === '0') {
$this->sessioninfo[$sessionid]->sessdate + ($status->studentavailability * 60) > $time) { // This status not available to students.
continue;
}
if (empty($status->studentavailability) && ($session->sessdate + $duration >= $time) &&
!empty(get_config('attendance', 'automark_useempty'))) {
// This is set to null - always available to students until end of session..
return $status->id;
}
if ($this->sessioninfo[$sessionid]->sessdate + ($status->studentavailability * 60) > $time) {
// Found first status we could set. // Found first status we could set.
return $status->id; return $status->id;
} }

10
db/upgrade.php

@ -691,5 +691,15 @@ function xmldb_attendance_upgrade($oldversion=0) {
upgrade_mod_savepoint(true, 2021082402, 'attendance'); upgrade_mod_savepoint(true, 2021082402, 'attendance');
} }
if ($oldversion < 2021082600) {
// Check if auto-marking in use, and if so, set automark_useempty = 0 to prevent changes in existing behaviour.
if ($DB->record_exists_select('attendance_sessions', 'automark > 0')) {
set_config('automark_useempty', '0', 'attendance');
}
// Attendance savepoint reached.
upgrade_mod_savepoint(true, 2021082600, 'attendance');
}
return $result; return $result;
} }

2
lang/en/attendance.php

@ -76,6 +76,8 @@ $string['attrecords'] = 'Attendances records';
$string['autoassignstatus'] = 'Automatically select highest status available'; $string['autoassignstatus'] = 'Automatically select highest status available';
$string['autoassignstatus_help'] = 'If this is selected, students will automatically be assigned the highest available grade.'; $string['autoassignstatus_help'] = 'If this is selected, students will automatically be assigned the highest available grade.';
$string['automark'] = 'Automatic marking'; $string['automark'] = 'Automatic marking';
$string['automarkuseempty'] = 'Auto-mark status availability handling';
$string['automarkuseempty_desc'] = 'If ticked, status items that have an empty/unset "available for" setting will be allowed during auto-marking';
$string['selectactivity'] = 'Select activity'; $string['selectactivity'] = 'Select activity';
$string['automark_help'] = 'Allows marking to be completed automatically. $string['automark_help'] = 'Allows marking to be completed automatically.
If "Yes" students will be automatically marked depending on their first access to the course. If "Yes" students will be automatically marked depending on their first access to the course.

4
settings.php

@ -106,6 +106,10 @@ if ($ADMIN->fulltree) {
get_string('enablewarnings', 'attendance'), get_string('enablewarnings', 'attendance'),
get_string('enablewarnings_desc', 'attendance'), 0)); get_string('enablewarnings_desc', 'attendance'), 0));
$settings->add(new admin_setting_configcheckbox('attendance/automark_useempty',
get_string('automarkuseempty', 'attendance'),
get_string('automarkuseempty_desc', 'attendance'), 1));
$fields = array('id' => get_string('studentid', 'attendance')); $fields = array('id' => get_string('studentid', 'attendance'));
$customfields = profile_get_custom_fields(); $customfields = profile_get_custom_fields();
foreach ($customfields as $field) { foreach ($customfields as $field) {

4
version.php

@ -23,9 +23,9 @@
*/ */
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$plugin->version = 2021082403; $plugin->version = 2021082600;
$plugin->requires = 2021051700; // Requires 3.11. $plugin->requires = 2021051700; // Requires 3.11.
$plugin->release = '3.11.9'; $plugin->release = '3.11.10';
$plugin->maturity = MATURITY_STABLE; $plugin->maturity = MATURITY_STABLE;
$plugin->cron = 0; $plugin->cron = 0;
$plugin->component = 'mod_attendance'; $plugin->component = 'mod_attendance';

Loading…
Cancel
Save