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

2
.idea/php.xml generated
View File

@@ -10,7 +10,7 @@
</component>
<component name="PHPCSFixerOptionsConfiguration">
<option name="codingStandard" value="Custom" />
<option name="rulesetPath" value="/app/.php-cs-fixer.dist.php" />
<option name="rulesetPath" value=".php-cs-fixer.dist.php" />
<option name="transferred" value="true" />
</component>
<component name="PHPCodeSnifferOptionsConfiguration">

View File

@@ -1,34 +0,0 @@
<?php
declare(strict_types=1);
namespace App\Command;
use App\Repository\CandidateRepository;
use App\Repository\QuizRepository;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
#[AsCommand(
name: 'app:test-command',
description: 'Add a short description for your command',
)]
class TestCommand extends Command
{
public function __construct(private readonly CandidateRepository $candidateRepository, private readonly QuizRepository $quizRepository)
{
parent::__construct();
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
new SymfonyStyle($input, $output);
dd($this->candidateRepository->getScores($this->quizRepository->find('1f00ff44-6f12-630e-9b87-67e78e97c05e')));
return Command::SUCCESS;
}
}

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');
}

View File

@@ -9,6 +9,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
/** @extends AbstractType<null> */
class EnterNameType extends AbstractType
{
public function __construct(private readonly TranslatorInterface $translator) {}

View File

@@ -9,16 +9,19 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Regex;
use Symfony\Contracts\Translation\TranslatorInterface;
/** @extends AbstractType<null> */
class SelectSeasonType extends AbstractType
{
public function __construct(private readonly TranslatorInterface $translator) {}
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('season_code', TextType::class,
['required' => true, 'constraints' => new Regex(pattern: "/^[A-Za-z\d]{5}$/")],
['required' => true, 'constraints' => new Regex(pattern: "/^[A-Za-z\d]{5}$/"), 'label' => $this->translator->trans('Season Code')]
)
// ->add('submit', SubmitType::class, ['label' => 'Start quiz'])
;
}

View File

@@ -17,6 +17,4 @@ class QuizRepository extends ServiceEntityRepository
{
parent::__construct($registry, Quiz::class);
}
public function quizReault(Quiz $quiz): array {}
}

View File

@@ -10,11 +10,7 @@ use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
/**
* @extends ServiceEntityRepository<User>
*
* @implements PasswordUpgraderInterface<User>
*/
/** @extends ServiceEntityRepository<User> */
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface
{
public function __construct(ManagerRegistry $registry)

View File

@@ -9,6 +9,7 @@ use App\Entity\User;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
/** @extends Voter<string, Season> */
final class SeasonVoter extends Voter
{
public const string EDIT = 'SEASON_EDIT';

View File

@@ -8,13 +8,14 @@ Corrections: Jokers
'Create an account': 'Maak een account aan'
Email: E-mail
'Enter your name': 'Voor je naam in'
'Invalid season code': 'Ongeldige seizoenscode'
'Load Prepared Elimination': 'Laad voorbereide eliminatie'
Manage: Beheren
Name: Naam
'No active quiz': 'Geen actieve test'
'No results': 'Geen resultaten'
'Number of dropouts:': 'Aantal afvallers:'
Owner(s): Eigenar(en)
Owner(s): Eigena(a)r(en)
Password: Wachtwoord
'Please Confirm your Email': messages
'Please sign in': 'Log in aub'