From bab431514ec6e6da32a9b63a2b982fdfc447db2b Mon Sep 17 00:00:00 2001 From: Elmar Ludwig Date: Mon, 17 Mar 2025 11:52:09 +0000 Subject: correctly check for empty exercise_refs, pass missing solver_id, fixes #5309 and #5116 Closes #5309 and #5116 Merge request studip/studip!4049 --- app/controllers/vips/sheets.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/vips/sheets.php b/app/controllers/vips/sheets.php index d627d96..60799a9 100644 --- a/app/controllers/vips/sheets.php +++ b/app/controllers/vips/sheets.php @@ -377,7 +377,7 @@ class Vips_SheetsController extends AuthenticatedController $this->user_end_time = $assignment->getUserEndTime($solver_id); $this->remaining_time = $this->user_end_time - time(); - $this->contentbar = $this->create_contentbar($assignment, $exercise_id, 'show'); + $this->contentbar = $this->create_contentbar($assignment, $exercise_id, 'show', $solver_id); $widget = new ActionsWidget(); @@ -528,7 +528,7 @@ class Vips_SheetsController extends AuthenticatedController $this->exam_terms = null; $this->preview_exam_terms = null; - $this->contentbar = $this->create_contentbar($assignment, null, 'show'); + $this->contentbar = $this->create_contentbar($assignment, null, 'show', $solver_id); if (!$assignment->checkEditPermission()) { if (!$assignment->isRunning() || !$assignment->active) { @@ -2225,13 +2225,13 @@ class Vips_SheetsController extends AuthenticatedController $toc->setURL($this->url_for("vips/sheets/{$view}_assignment", ['assignment_id' => $assignment->id])); $toc->setActive($exercise_id === null); - if ($view === 'edit' && !empty($assignment->test->exercise_refs)) { - $exercise_refs = $assignment->test->exercise_refs; - } else { - $exercise_refs = $assignment->getExerciseRefs($solver_id); - } + if (!empty($assignment->test->exercise_refs)) { + if ($view === 'edit') { + $exercise_refs = $assignment->test->exercise_refs; + } else { + $exercise_refs = $assignment->getExerciseRefs($solver_id); + } - if (!empty($exercise_refs)) { foreach ($exercise_refs as $i => $item) { $child = new TOCItem(sprintf('%d. %s', $i + 1, $item->exercise->title)); $child->setURL($this->url_for( -- cgit v1.0