Preserve randomized question order in test results

This commit is contained in:
Wojtek
2026-10-16 21:31:59 +02:00
parent ba9e236e83
commit 1da3149e2f
5 changed files with 26 additions and 2 deletions
@@ -84,6 +84,9 @@ $resolveImageUrl = static function ($path) {
<?php endif; ?>
<?php if ($this->items) : ?>
<form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES, 'UTF-8'); ?>" method="post" id="test-form">
<?php if (!$this->results) : ?>
<?php foreach ($this->items as $item) : ?><input type="hidden" name="question_order[]" value="<?php echo (int) $item->id; ?>"><?php endforeach; ?>
<?php endif; ?>
<?php foreach ($this->items as $number => $item) : ?>
<?php
$answerOrder = $this->results && !empty($this->results['items'][$item->id]['answer_order'])