wip 12-03-2025
Some checks failed
CI / Tests (push) Failing after 11s
CI / Docker Lint (push) Successful in 3s

This commit is contained in:
2025-03-12 09:28:36 +01:00
parent f7b4b98da4
commit 448daed6ea
21 changed files with 523 additions and 103 deletions

View File

@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
namespace App\Controller;
use App\Entity\Quiz;
use App\Entity\Season;
use App\Repository\SeasonRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Attribute\AsController;
use Symfony\Component\Routing\Attribute\Route;
#[AsController]
#[Route('/backoffice', name: 'backoffice_')]
final class BackofficeController extends AbstractController
{
public function __construct(private readonly SeasonRepository $seasonRepository)
{
}
#[Route('/', name: 'index')]
public function index(): Response
{
$seasons = $this->seasonRepository->findAll();
return $this->render('backoffice/index.html.twig', [
'seasons' => $seasons,
]);
}
#[Route('/{seasonCode}', name: 'season')]
public function season(Season $season): Response
{
return $this->render('backoffice/season.html.twig', [
'season' => $season,
]);
}
#[Route('/{seasonCode}/{quiz}', name: 'quiz')]
public function quiz(Season $season, Quiz $quiz): Response
{
return $this->render('backoffice/quiz.html.twig', [
'season' => $season,
'quiz' => $quiz,
]);
}
}

View File

@@ -25,7 +25,7 @@ use Symfony\Component\HttpKernel\Attribute\AsController;
use Symfony\Component\Routing\Attribute\Route;
#[AsController]
class QuizController extends AbstractController
final class QuizController extends AbstractController
{
public const string SEASON_CODE_REGEX = '[A-Za-z\d]{5}';
private const string CANDIDATE_HASH_REGEX = '[\w\-=]+';
@@ -102,7 +102,8 @@ class QuizController extends AbstractController
$givenAnswer = (new GivenAnswer())
->setCandidate($candidate)
->setAnswer($answer);
->setAnswer($answer)
->setQuiz($answer->getQuestion()->getQuiz());
$givenAnswerRepository->save($givenAnswer);
}