Skip to content
Snippets Groups Projects
Commit 880e367b authored by Elmar Ludwig's avatar Elmar Ludwig
Browse files

cast assignment_id in payload to string, fixes #265

parent dc677dde
No related branches found
No related tags found
No related merge requests found
...@@ -24,8 +24,7 @@ class ApiController extends StudipController ...@@ -24,8 +24,7 @@ class ApiController extends StudipController
foreach ($assignments as $assignment) { foreach ($assignments as $assignment) {
if ($assignment->type !== 'exam') { if ($assignment->type !== 'exam') {
$data[] = [ $data[] = [
'id' => $assignment->id, 'id' => (string) $assignment->id,
'link' => $this->url_for('api/assignment', $assignment->id),
'title' => $assignment->test->title, 'title' => $assignment->test->title,
'type' => $assignment->type, 'type' => $assignment->type,
'icon' => $assignment->getTypeIcon()->getShape(), 'icon' => $assignment->getTypeIcon()->getShape(),
...@@ -63,7 +62,7 @@ class ApiController extends StudipController ...@@ -63,7 +62,7 @@ class ApiController extends StudipController
} }
$data = [ $data = [
'id' => $assignment->id, 'id' => (string) $assignment->id,
'title' => $assignment->test->title, 'title' => $assignment->test->title,
'type' => $assignment->type, 'type' => $assignment->type,
'icon' => $assignment->getTypeIcon()->getShape(), 'icon' => $assignment->getTypeIcon()->getShape(),
...@@ -83,7 +82,6 @@ class ApiController extends StudipController ...@@ -83,7 +82,6 @@ class ApiController extends StudipController
$data['exercises'][] = [ $data['exercises'][] = [
'id' => $exercise->id, 'id' => $exercise->id,
'link' => $this->url_for('api/exercise', $assignment_id, $exercise->id),
'type' => $exercise->type, 'type' => $exercise->type,
'title' => $exercise->title, 'title' => $exercise->title,
'template' => $template->render(), 'template' => $template->render(),
...@@ -140,6 +138,7 @@ class ApiController extends StudipController ...@@ -140,6 +138,7 @@ class ApiController extends StudipController
$solution = $assignment->getSolution($user_id, $exercise->id); $solution = $assignment->getSolution($user_id, $exercise->id);
$max_tries = $assignment->getMaxTries(); $max_tries = $assignment->getMaxTries();
$max_points = $exercise_ref->points; $max_points = $exercise_ref->points;
$sample_solution = false;
$show_solution = false; $show_solution = false;
$tries_left = null; $tries_left = null;
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<? else: ?> <? else: ?>
<?= $this->render_partial($exercise->getSolveTemplate($solution, $assignment, $user_id)) ?> <?= $this->render_partial($exercise->getSolveTemplate($solution, $assignment, $user_id)) ?>
<? if ($exercise->options['comment']): ?> <? if (!empty($exercise->options['comment'])): ?>
<label> <label>
<?= _vips('Bemerkungen zur Lösung (optional)') ?> <?= _vips('Bemerkungen zur Lösung (optional)') ?>
<textarea name="student_comment"><?= htmlReady($solution->student_comment) ?></textarea> <textarea name="student_comment"><?= htmlReady($solution->student_comment) ?></textarea>
......
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
<?= $this->render_partial($exercise->getSolveTemplate($solution, $assignment, $solver_id)) ?> <?= $this->render_partial($exercise->getSolveTemplate($solution, $assignment, $solver_id)) ?>
<? if (isset($exercise->options['comment']) && $exercise->options['comment']) : ?> <? if (!empty($exercise->options['comment'])) : ?>
<label> <label>
<?= _vips('Bemerkungen zur Lösung (optional)') ?> <?= _vips('Bemerkungen zur Lösung (optional)') ?>
<textarea name="student_comment"><?= $solution ? htmlReady($solution->student_comment) : '' ?></textarea> <textarea name="student_comment"><?= $solution ? htmlReady($solution->student_comment) : '' ?></textarea>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment