This commit is contained in:
2025-04-21 18:03:54 +02:00
parent f44b63a91f
commit 057bc778ed
9 changed files with 14 additions and 50 deletions

View File

@@ -29,14 +29,11 @@ use Symfony\Contracts\Translation\TranslatorInterface;
#[AsController]
final class QuizController extends AbstractController
{
public const string SEASON_CODE_REGEX = '[A-Za-z\d]{5}';
private const string CANDIDATE_HASH_REGEX = '[\w\-=]+';
public function __construct(private readonly TranslatorInterface $translator)
{
}
public function __construct(private readonly TranslatorInterface $translator) {}
#[Route(path: '/', name: 'app_quiz_selectseason', methods: ['GET', 'POST'])]
public function selectSeason(Request $request, SeasonRepository $seasonRepository): Response
@@ -48,8 +45,9 @@ final class QuizController extends AbstractController
$data = $form->getData();
$season_code = $data['season_code'];
if ($seasonRepository->findBy(['seasonCode' => $season_code]) === []) {
if ([] === $seasonRepository->findBy(['seasonCode' => $season_code])) {
$this->addFlash(FlashType::Warning, $this->translator->trans('Invalid season code'));
return $this->redirectToRoute('app_quiz_selectseason');
}