mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-07-04 22:50:15 +02:00
281462fab8
* Added Gedmo stuff, fix translations * Add CSRF token validation across backoffice forms - Added CSRF validations to candidate correction, penalty, answer saving, and elimination forms. - Updated corresponding Twig templates to include CSRF token inputs. - Adjusted column count in `tab_result` template to maintain layout consistency. * Add unique index constraint for `quiz_candidate` with soft delete support - Updated migration to include a unique index on `quiz_candidate` table that excludes soft-deleted records. - Adjusted `QuizCandidate` entity to reflect the new unique constraint with `deleted_at` condition. * Add CSRF token validation for quiz-related actions - Added CSRF validation to `enableQuiz`, `clearQuiz`, `deleteQuiz`, `toggleCandidate`, and `prepareElimination` actions. - Updated Twig templates to replace links with POST forms to include CSRF tokens. - Set HTTP method restrictions for related endpoints to `POST`. * Fix unique index condition for `quiz_candidate` with soft deletes - Updated condition in unique index definition of `quiz_candidate` to add parentheses for clarity. - Adjusted related migration to reflect the revised condition. * Remove if for post an use methods in Route instead * Refactor CSRF token validation in backoffice controllers - Applied `#[IsCsrfTokenValid]` attribute for CSRF checks to simplify and standardize validation. - Removed manual `isCsrfTokenValid` calls and associated exception throwing. - Updated method signatures across affected endpoints to remove unnecessary `Request` dependency. - Ensured consistency in route HTTP method restrictions where applicable. * Add rector and phpstan * Add validation for answering incorrect quiz question - Added logic to prevent candidates from answering questions out of sequence in `QuizController`. - Updated Dutch translations to include the new error message. * Things
81 lines
3.9 KiB
Twig
81 lines
3.9 KiB
Twig
<h4 class="mb-3">{{ 'Score'|trans }}</h4>
|
|
<div class="btn-toolbar mb-3" role="toolbar">
|
|
<div class="btn-group me-2">
|
|
{# <a class="btn btn-primary">{{ 'Start Elimination'|trans }}</a> #}
|
|
<form action="{{ path('tvdt_prepare_elimination', {seasonCode: season.seasonCode, quiz: quiz.id}) }}" method="POST">
|
|
<input type="hidden" name="_token" value="{{ csrf_token('prepare_elimination') }}">
|
|
<button type="submit" class="btn btn-secondary rounded-0 rounded-start">{{ 'Prepare Custom Elimination'|trans }}</button>
|
|
</form>
|
|
{%~ if not quiz.eliminations.empty %}
|
|
<button class="btn btn-secondary dropdown-toggle"
|
|
data-bs-toggle="dropdown">{{ 'Load Prepared Elimination'|trans }}</button>
|
|
<ul class="dropdown-menu">
|
|
{%~ for elimination in quiz.eliminations %}
|
|
<li><a class="dropdown-item"
|
|
href="{{ path('tvdt_prepare_elimination_view', {elimination: elimination.id}) }}">{{ elimination.createdAt|format_datetime() }}</a>
|
|
</li>
|
|
{%~ endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<p class="mb-3">{{ 'Number of dropouts:'|trans }} {{ quiz.dropouts }} </p>
|
|
<table class="table table-hover mb-3">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">{{ 'Candidate'|trans }}</th>
|
|
<th style="width: 15%" scope="col">{{ 'Correct Answers'|trans }}</th>
|
|
<th style="width: 20%" scope="col">{{ 'Corrections'|trans }}</th>
|
|
<th style="width: 20%" scope="col">{{ 'Penalty'|trans }}</th>
|
|
<th style="width: 10%" scope="col">{{ 'Score'|trans }}</th>
|
|
<th style="width: 20%" scope="col">{{ 'Time'|trans }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{%~ for candidate in result ~%}
|
|
<tr class="table-{% if loop.revindex > quiz.dropouts %}success{% else %}danger{% endif %}">
|
|
<td>{{ candidate.name }}</td>
|
|
<td>{{ candidate.correct|default('0') }}</td>
|
|
<td>
|
|
<form method="post"
|
|
action="{{ path('tvdt_backoffice_modify_correction', {quiz: quiz.id, candidate: candidate.id}) }}">
|
|
<input type="hidden" name="_token" value="{{ csrf_token('candidate_correction') }}">
|
|
<div class="row">
|
|
<div class="col-8">
|
|
<input class="form-control form-control-sm" type="number"
|
|
value="{{ candidate.corrections }}" step="0.5"
|
|
name="corrections">
|
|
</div>
|
|
<div class="col-2">
|
|
<button class="btn btn-sm btn-primary" type="submit">{{ 'Save'|trans }}</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</td>
|
|
<td>
|
|
<form method="post"
|
|
action="{{ path('tvdt_backoffice_modify_penalty', {quiz: quiz.id, candidate: candidate.id}) }}">
|
|
<input type="hidden" name="_token" value="{{ csrf_token('candidate_penalty') }}">
|
|
<div class="row">
|
|
<div class="col-8">
|
|
<input class="form-control form-control-sm" type="number"
|
|
value="{{ candidate.penaltySeconds }}" step="1"
|
|
name="penalty">
|
|
</div>
|
|
<div class="col-2">
|
|
<button class="btn btn-sm btn-primary" type="submit">{{ 'Save'|trans }}</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</td>
|
|
<td>{{ candidate.score|default('x') }}</td>
|
|
<td>{{ candidate.time.format('%i:%S') }}</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr>
|
|
<td colspan="6">{{ 'No results'|trans }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|