diff --git a/teacherview.php b/teacherview.php index 7b248505..b7f056b1 100644 --- a/teacherview.php +++ b/teacherview.php @@ -438,6 +438,9 @@ function scheduler_print_schedulebox(scheduler_instance $scheduler, $studentid, $offset = 0; } } +if ($offset * $pagesize >= $sqlcount && $sqlcount > 0) { + $offset = floor(($sqlcount-1) / $pagesize); +} $slots = $scheduler->get_slots_for_teacher($teacherid, $currentgroup, $offset * $pagesize, $pagesize);