From 47003a429aff42a715c15a0a6d26c8105544413f Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Tue, 29 Jan 2019 15:25:13 +1300 Subject: [PATCH] Fix #340 Check duration of session when checking if a student enrolled before a session. --- renderer.php | 2 +- renderhelpers.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/renderer.php b/renderer.php index 581f83c..c5f63f3 100644 --- a/renderer.php +++ b/renderer.php @@ -819,7 +819,7 @@ class mod_attendance_renderer extends plugin_renderer_base { $row->cells[] = format_float($status->grade, 1, true, true) . ' / ' . format_float($statussetmaxpoints[$status->setnumber], 1, true, true); $row->cells[] = $sess->remarks; - } else if ($sess->sessdate < $userdata->user->enrolmentstart) { + } else if (($sess->sessdate + $sess->duration) < $userdata->user->enrolmentstart) { $cell = new html_table_cell(get_string('enrolmentstart', 'attendance', userdate($userdata->user->enrolmentstart, '%d.%m.%Y'))); $cell->colspan = 2; diff --git a/renderhelpers.php b/renderhelpers.php index bf07176..04490c7 100644 --- a/renderhelpers.php +++ b/renderhelpers.php @@ -60,7 +60,7 @@ class user_sessions_cells_generator { $this->construct_remarks_cell($this->reportdata->sessionslog[$this->user->id][$sess->id]->remarks); } } else { - if ($this->user->enrolmentstart > $sess->sessdate) { + if ($this->user->enrolmentstart > ($sess->sessdate + $sess->duration)) { $starttext = get_string('enrolmentstart', 'attendance', userdate($this->user->enrolmentstart, '%d.%m.%Y')); $this->construct_enrolments_info_cell($starttext); } else if ($this->user->enrolmentend and $this->user->enrolmentend < $sess->sessdate) {