diff options
| author | Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> | 2025-03-17 11:52:09 +0000 |
|---|---|---|
| committer | Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> | 2025-03-17 11:52:09 +0000 |
| commit | bab431514ec6e6da32a9b63a2b982fdfc447db2b (patch) | |
| tree | cc0b304f0c6b1969840a31ecfceaa47e635b1134 /app/controllers/vips | |
| parent | 9804c00660866c403f19805692ce5381f388411d (diff) | |
correctly check for empty exercise_refs, pass missing solver_id, fixes #5309 and #5116
Closes #5309 and #5116
Merge request studip/studip!4049
Diffstat (limited to 'app/controllers/vips')
| -rw-r--r-- | app/controllers/vips/sheets.php | 16 |
1 files 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( |
