From 448daed6ea3345b73ae5c61964cecbc75aace969 Mon Sep 17 00:00:00 2001 From: Marijn Doeve Date: Wed, 12 Mar 2025 09:28:36 +0100 Subject: [PATCH] wip 12-03-2025 --- .idea/TijdVoorDeTest.iml | 1 + .idea/jsLibraryMappings.xml | 2 +- .idea/sonarlint.xml | 8 ++ Taskfile.yml | 6 +- composer.json | 12 +-- composer.lock | 106 ++++++++++----------- config/routes/attributes.yaml | 12 +-- migrations/Version20250311213417.php | 119 ++++++++++++++++++++++++ src/Controller/BackofficeController.php | 49 ++++++++++ src/Controller/QuizController.php | 5 +- src/Entity/GivenAnswer.php | 4 +- src/Entity/Quiz.php | 15 +++ src/Repository/QuizRepository.php | 4 + templates/backoffice/base.html.twig | 37 ++++++++ templates/backoffice/index.html.twig | 48 ++++++++++ templates/backoffice/nav.html.twig | 22 +++++ templates/backoffice/quiz.html.twig | 95 +++++++++++++++++++ templates/backoffice/season.html.twig | 26 ++++++ templates/base.html.twig | 17 ---- translations/messages+intl-icu.nl.xlf | 14 --- translations/messages+intl-icu.nl.yaml | 24 +++++ 21 files changed, 523 insertions(+), 103 deletions(-) create mode 100644 .idea/sonarlint.xml create mode 100644 migrations/Version20250311213417.php create mode 100644 src/Controller/BackofficeController.php create mode 100644 templates/backoffice/base.html.twig create mode 100644 templates/backoffice/index.html.twig create mode 100644 templates/backoffice/nav.html.twig create mode 100644 templates/backoffice/quiz.html.twig create mode 100644 templates/backoffice/season.html.twig delete mode 100644 templates/base.html.twig delete mode 100644 translations/messages+intl-icu.nl.xlf create mode 100644 translations/messages+intl-icu.nl.yaml diff --git a/.idea/TijdVoorDeTest.iml b/.idea/TijdVoorDeTest.iml index 9c1a872..0d8b052 100644 --- a/.idea/TijdVoorDeTest.iml +++ b/.idea/TijdVoorDeTest.iml @@ -138,5 +138,6 @@ + \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml index b843835..4c9360b 100644 --- a/.idea/jsLibraryMappings.xml +++ b/.idea/jsLibraryMappings.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/sonarlint.xml b/.idea/sonarlint.xml new file mode 100644 index 0000000..258a18d --- /dev/null +++ b/.idea/sonarlint.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/Taskfile.yml b/Taskfile.yml index 0b82ba8..745383b 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -16,5 +16,7 @@ tasks: migrate: cmds: - docker compose run php bin/console doctrine:migrations:migrate - - + + translations: + cmds: + - docker compose exec php bin/console translation:extract --domain=messages --force --format=yaml --sort=asc --clean nl diff --git a/composer.json b/composer.json index 1cfd549..1f0446b 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "MarijnDoeve/TijdVoorDeTest", + "name": "marijndoeve/tijdvoordetest", "type": "project", "license": "MIT", "description": "A minimal Symfony project recommended to create bare bones applications", @@ -9,11 +9,11 @@ "php": ">=8.3.15", "ext-ctype": "*", "ext-iconv": "*", - "doctrine/dbal": "^4.2.2", + "doctrine/dbal": "^4.2.3", "doctrine/doctrine-bundle": "^2.13.2", "doctrine/doctrine-migrations-bundle": "^3.4.1", "doctrine/orm": "^3.3.2", - "easycorp/easyadmin-bundle": "^4.24.4", + "easycorp/easyadmin-bundle": "^4.24.5", "runtime/frankenphp-symfony": "^0.2.0", "symfony/asset": "7.2.*", "symfony/console": "7.2.*", @@ -31,13 +31,13 @@ "require-dev": { "roave/security-advisories": "dev-latest", "doctrine/doctrine-fixtures-bundle": "^4.0", - "friendsofphp/php-cs-fixer": "^3.70.2", + "friendsofphp/php-cs-fixer": "^3.71.0", "phpstan/extension-installer": "^1.4.3", - "phpstan/phpstan": "^2.1.7", + "phpstan/phpstan": "^2.1.8", "phpstan/phpstan-doctrine": "^2.0.2", "phpstan/phpstan-phpunit": "^2.0.4", "phpstan/phpstan-symfony": "^2.0.2", - "phpunit/phpunit": "^11.5.11", + "phpunit/phpunit": "^11.5.12", "rector/rector": "^2.0.10", "symfony/maker-bundle": "^1.62.1", "symfony/stopwatch": "7.2.*", diff --git a/composer.lock b/composer.lock index 158fce6..75488d5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5b43ef4edb1211b94fd4f8ec696221cc", + "content-hash": "45bc0712d79d3b5a625b352cbf14afda", "packages": [ { "name": "doctrine/cache", @@ -187,16 +187,16 @@ }, { "name": "doctrine/dbal", - "version": "4.2.2", + "version": "4.2.3", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "19a2b7deb5fe8c2df0ff817ecea305e50acb62ec" + "reference": "33d2d7fe1269b2301640c44cf2896ea607b30e3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/19a2b7deb5fe8c2df0ff817ecea305e50acb62ec", - "reference": "19a2b7deb5fe8c2df0ff817ecea305e50acb62ec", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/33d2d7fe1269b2301640c44cf2896ea607b30e3e", + "reference": "33d2d7fe1269b2301640c44cf2896ea607b30e3e", "shasum": "" }, "require": { @@ -273,7 +273,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/4.2.2" + "source": "https://github.com/doctrine/dbal/tree/4.2.3" }, "funding": [ { @@ -289,7 +289,7 @@ "type": "tidelift" } ], - "time": "2025-01-16T08:40:56+00:00" + "time": "2025-03-07T18:29:05+00:00" }, { "name": "doctrine/deprecations", @@ -1217,16 +1217,16 @@ }, { "name": "easycorp/easyadmin-bundle", - "version": "v4.24.4", + "version": "v4.24.5", "source": { "type": "git", "url": "https://github.com/EasyCorp/EasyAdminBundle.git", - "reference": "fd1b0e555655a5d8df67a0a48a28e07a1dd0d6f8" + "reference": "dcc64d06fc142f894667439e72837aa3742b5460" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/EasyCorp/EasyAdminBundle/zipball/fd1b0e555655a5d8df67a0a48a28e07a1dd0d6f8", - "reference": "fd1b0e555655a5d8df67a0a48a28e07a1dd0d6f8", + "url": "https://api.github.com/repos/EasyCorp/EasyAdminBundle/zipball/dcc64d06fc142f894667439e72837aa3742b5460", + "reference": "dcc64d06fc142f894667439e72837aa3742b5460", "shasum": "" }, "require": { @@ -1262,11 +1262,11 @@ }, "require-dev": { "doctrine/doctrine-fixtures-bundle": "^3.4|3.5.x-dev", - "phpstan/extension-installer": "^1.2", - "phpstan/phpstan": "^1.9", - "phpstan/phpstan-phpunit": "^1.2", - "phpstan/phpstan-strict-rules": "^1.4", - "phpstan/phpstan-symfony": "^1.2", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpstan/phpstan-symfony": "^2.0", "psr/log": "^1.0", "symfony/browser-kit": "^5.4|^6.0|^7.0", "symfony/css-selector": "^5.4|^6.0|^7.0", @@ -1307,7 +1307,7 @@ ], "support": { "issues": "https://github.com/EasyCorp/EasyAdminBundle/issues", - "source": "https://github.com/EasyCorp/EasyAdminBundle/tree/v4.24.4" + "source": "https://github.com/EasyCorp/EasyAdminBundle/tree/v4.24.5" }, "funding": [ { @@ -1315,7 +1315,7 @@ "type": "github" } ], - "time": "2025-02-19T19:52:22+00:00" + "time": "2025-03-10T19:31:19+00:00" }, { "name": "psr/cache", @@ -6858,16 +6858,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.70.2", + "version": "v3.71.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "1ca468270efbb75ce0c7566a79cca8ea2888584d" + "reference": "3825ffdc69501e1c9230291b79f036a0c0d8749d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/1ca468270efbb75ce0c7566a79cca8ea2888584d", - "reference": "1ca468270efbb75ce0c7566a79cca8ea2888584d", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/3825ffdc69501e1c9230291b79f036a0c0d8749d", + "reference": "3825ffdc69501e1c9230291b79f036a0c0d8749d", "shasum": "" }, "require": { @@ -6949,7 +6949,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.70.2" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.71.0" }, "funding": [ { @@ -6957,7 +6957,7 @@ "type": "github" } ], - "time": "2025-03-03T21:07:23+00:00" + "time": "2025-03-07T23:06:56+00:00" }, { "name": "myclabs/deep-copy", @@ -7245,16 +7245,16 @@ }, { "name": "phpstan/phpstan", - "version": "2.1.7", + "version": "2.1.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "12567f91a74036d56ba0af6d56c8e73ac0e8d850" + "reference": "f9adff3b87c03b12cc7e46a30a524648e497758f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/12567f91a74036d56ba0af6d56c8e73ac0e8d850", - "reference": "12567f91a74036d56ba0af6d56c8e73ac0e8d850", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f9adff3b87c03b12cc7e46a30a524648e497758f", + "reference": "f9adff3b87c03b12cc7e46a30a524648e497758f", "shasum": "" }, "require": { @@ -7299,7 +7299,7 @@ "type": "github" } ], - "time": "2025-03-05T13:43:55+00:00" + "time": "2025-03-09T09:30:48+00:00" }, { "name": "phpstan/phpstan-doctrine", @@ -7819,16 +7819,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.5.11", + "version": "11.5.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3946ac38410be7440186c6e74584f31b15107fc7" + "reference": "d42785840519401ed2113292263795eb4c0f95da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3946ac38410be7440186c6e74584f31b15107fc7", - "reference": "3946ac38410be7440186c6e74584f31b15107fc7", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d42785840519401ed2113292263795eb4c0f95da", + "reference": "d42785840519401ed2113292263795eb4c0f95da", "shasum": "" }, "require": { @@ -7849,7 +7849,7 @@ "phpunit/php-timer": "^7.0.1", "sebastian/cli-parser": "^3.0.2", "sebastian/code-unit": "^3.0.2", - "sebastian/comparator": "^6.3.0", + "sebastian/comparator": "^6.3.1", "sebastian/diff": "^6.0.2", "sebastian/environment": "^7.2.0", "sebastian/exporter": "^6.3.0", @@ -7900,7 +7900,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.11" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.12" }, "funding": [ { @@ -7916,7 +7916,7 @@ "type": "tidelift" } ], - "time": "2025-03-05T07:36:02+00:00" + "time": "2025-03-07T07:31:03+00:00" }, { "name": "react/cache", @@ -8509,12 +8509,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "93d6f477df354be282736a37f732e39382ff9f95" + "reference": "eab95f065c8f07444ff8ea062ae32a2df83e20ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/93d6f477df354be282736a37f732e39382ff9f95", - "reference": "93d6f477df354be282736a37f732e39382ff9f95", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/eab95f065c8f07444ff8ea062ae32a2df83e20ea", + "reference": "eab95f065c8f07444ff8ea062ae32a2df83e20ea", "shasum": "" }, "conflict": { @@ -8615,7 +8615,7 @@ "codiad/codiad": "<=2.8.4", "components/jquery": ">=1.0.3,<3.5", "composer/composer": "<1.10.27|>=2,<2.2.24|>=2.3,<2.7.7", - "concrete5/concrete5": "<9.3.4", + "concrete5/concrete5": "<9.4.0.0-RC1-dev", "concrete5/core": "<8.5.8|>=9,<9.1", "contao-components/mediaelement": ">=2.14.2,<2.21.1", "contao/comments-bundle": ">=2,<4.13.40|>=5.0.0.0-RC1-dev,<5.3.4", @@ -8737,7 +8737,7 @@ "friendsoftypo3/mediace": ">=7.6.2,<7.6.5", "friendsoftypo3/openid": ">=4.5,<4.5.31|>=4.7,<4.7.16|>=6,<6.0.11|>=6.1,<6.1.6", "froala/wysiwyg-editor": "<3.2.7|>=4.0.1,<=4.1.3", - "froxlor/froxlor": "<=2.2.0.0-RC3", + "froxlor/froxlor": "<=2.2.5", "frozennode/administrator": "<=5.0.12", "fuel/core": "<1.8.1", "funadmin/funadmin": "<=5.0.2", @@ -8996,7 +8996,7 @@ "phpmyadmin/phpmyadmin": "<5.2.2", "phpmyfaq/phpmyfaq": "<3.2.5|==3.2.5|>=3.2.10,<=4.0.1", "phpoffice/common": "<0.2.9", - "phpoffice/phpexcel": "<1.8.1", + "phpoffice/phpexcel": "<=1.8.2", "phpoffice/phpspreadsheet": "<1.29.9|>=2,<2.1.8|>=2.2,<2.3.7|>=3,<3.9", "phpseclib/phpseclib": "<2.0.47|>=3,<3.0.36", "phpservermon/phpservermon": "<3.6", @@ -9017,7 +9017,7 @@ "pixelfed/pixelfed": "<0.11.11", "plotly/plotly.js": "<2.25.2", "pocketmine/bedrock-protocol": "<8.0.2", - "pocketmine/pocketmine-mp": "<5.11.2", + "pocketmine/pocketmine-mp": "<5.25.2", "pocketmine/raklib": ">=0.14,<0.14.6|>=0.15,<0.15.1", "pressbooks/pressbooks": "<5.18", "prestashop/autoupgrade": ">=4,<4.10.1", @@ -9098,8 +9098,8 @@ "silverstripe/userforms": "<3|>=5,<5.4.2", "silverstripe/versioned-admin": ">=1,<1.11.1", "simple-updates/phpwhois": "<=1", - "simplesamlphp/saml2": "<4.6.14|==5.0.0.0-alpha12", - "simplesamlphp/saml2-legacy": "<4.6.14", + "simplesamlphp/saml2": "<=4.6.15|>=5.0.0.0-alpha1,<=5.0.0.0-alpha19", + "simplesamlphp/saml2-legacy": "<=4.6.15", "simplesamlphp/simplesamlphp": "<1.18.6", "simplesamlphp/simplesamlphp-module-infocard": "<1.0.1", "simplesamlphp/simplesamlphp-module-openid": "<1", @@ -9378,7 +9378,7 @@ "type": "tidelift" } ], - "time": "2025-03-05T20:05:33+00:00" + "time": "2025-03-11T21:04:43+00:00" }, { "name": "sebastian/cli-parser", @@ -9552,16 +9552,16 @@ }, { "name": "sebastian/comparator", - "version": "6.3.0", + "version": "6.3.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "d4e47a769525c4dd38cea90e5dcd435ddbbc7115" + "reference": "24b8fbc2c8e201bb1308e7b05148d6ab393b6959" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/d4e47a769525c4dd38cea90e5dcd435ddbbc7115", - "reference": "d4e47a769525c4dd38cea90e5dcd435ddbbc7115", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/24b8fbc2c8e201bb1308e7b05148d6ab393b6959", + "reference": "24b8fbc2c8e201bb1308e7b05148d6ab393b6959", "shasum": "" }, "require": { @@ -9580,7 +9580,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "6.2-dev" + "dev-main": "6.3-dev" } }, "autoload": { @@ -9620,7 +9620,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/6.3.0" + "source": "https://github.com/sebastianbergmann/comparator/tree/6.3.1" }, "funding": [ { @@ -9628,7 +9628,7 @@ "type": "github" } ], - "time": "2025-01-06T10:28:19+00:00" + "time": "2025-03-07T06:57:01+00:00" }, { "name": "sebastian/complexity", diff --git a/config/routes/attributes.yaml b/config/routes/attributes.yaml index 24051c3..718128b 100644 --- a/config/routes/attributes.yaml +++ b/config/routes/attributes.yaml @@ -1,9 +1,9 @@ controllers: - resource: - path: ../../src/Controller/ - namespace: App\Controller - type: attribute + resource: + path: ../../src/Controller/ + namespace: App\Controller + type: attribute kernel: - resource: App\Kernel - type: attribute + resource: App\Kernel + type: attribute diff --git a/migrations/Version20250311213417.php b/migrations/Version20250311213417.php new file mode 100644 index 0000000..f18576a --- /dev/null +++ b/migrations/Version20250311213417.php @@ -0,0 +1,119 @@ +addSql('ALTER TABLE answer ALTER id TYPE UUID'); + $this->addSql('ALTER TABLE answer ALTER question_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN answer.id IS \'\''); + $this->addSql('COMMENT ON COLUMN answer.question_id IS \'\''); + $this->addSql('ALTER TABLE answer_candidate ALTER answer_id TYPE UUID'); + $this->addSql('ALTER TABLE answer_candidate ALTER candidate_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN answer_candidate.answer_id IS \'\''); + $this->addSql('COMMENT ON COLUMN answer_candidate.candidate_id IS \'\''); + $this->addSql('ALTER TABLE candidate ALTER id TYPE UUID'); + $this->addSql('ALTER TABLE candidate ALTER season_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN candidate.id IS \'\''); + $this->addSql('COMMENT ON COLUMN candidate.season_id IS \'\''); + $this->addSql('ALTER TABLE correction ALTER id TYPE UUID'); + $this->addSql('ALTER TABLE correction ALTER candidate_id TYPE UUID'); + $this->addSql('ALTER TABLE correction ALTER quiz_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN correction.id IS \'\''); + $this->addSql('COMMENT ON COLUMN correction.candidate_id IS \'\''); + $this->addSql('COMMENT ON COLUMN correction.quiz_id IS \'\''); + $this->addSql('ALTER TABLE given_answer ALTER id TYPE UUID'); + $this->addSql('ALTER TABLE given_answer ALTER candidate_id TYPE UUID'); + $this->addSql('ALTER TABLE given_answer ALTER quiz_id TYPE UUID'); + $this->addSql('ALTER TABLE given_answer ALTER answer_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN given_answer.id IS \'\''); + $this->addSql('COMMENT ON COLUMN given_answer.candidate_id IS \'\''); + $this->addSql('COMMENT ON COLUMN given_answer.quiz_id IS \'\''); + $this->addSql('COMMENT ON COLUMN given_answer.answer_id IS \'\''); + $this->addSql('ALTER TABLE question ALTER id TYPE UUID'); + $this->addSql('ALTER TABLE question ALTER quiz_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN question.id IS \'\''); + $this->addSql('COMMENT ON COLUMN question.quiz_id IS \'\''); + $this->addSql('ALTER TABLE quiz ADD dropouts INT DEFAULT NULL'); + $this->addSql('ALTER TABLE quiz ALTER id TYPE UUID'); + $this->addSql('ALTER TABLE quiz ALTER season_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN quiz.id IS \'\''); + $this->addSql('COMMENT ON COLUMN quiz.season_id IS \'\''); + $this->addSql('ALTER TABLE season ALTER id TYPE UUID'); + $this->addSql('ALTER TABLE season ALTER active_quiz_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN season.id IS \'\''); + $this->addSql('COMMENT ON COLUMN season.active_quiz_id IS \'\''); + $this->addSql('ALTER TABLE season_user ALTER season_id TYPE UUID'); + $this->addSql('ALTER TABLE season_user ALTER user_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN season_user.season_id IS \'\''); + $this->addSql('COMMENT ON COLUMN season_user.user_id IS \'\''); + $this->addSql('ALTER TABLE "user" ALTER id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN "user".id IS \'\''); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE candidate ALTER id TYPE UUID'); + $this->addSql('ALTER TABLE candidate ALTER season_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN candidate.id IS \'(DC2Type:uuid)\''); + $this->addSql('COMMENT ON COLUMN candidate.season_id IS \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE correction ALTER id TYPE UUID'); + $this->addSql('ALTER TABLE correction ALTER candidate_id TYPE UUID'); + $this->addSql('ALTER TABLE correction ALTER quiz_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN correction.id IS \'(DC2Type:uuid)\''); + $this->addSql('COMMENT ON COLUMN correction.candidate_id IS \'(DC2Type:uuid)\''); + $this->addSql('COMMENT ON COLUMN correction.quiz_id IS \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE given_answer ALTER id TYPE UUID'); + $this->addSql('ALTER TABLE given_answer ALTER candidate_id TYPE UUID'); + $this->addSql('ALTER TABLE given_answer ALTER quiz_id TYPE UUID'); + $this->addSql('ALTER TABLE given_answer ALTER answer_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN given_answer.id IS \'(DC2Type:uuid)\''); + $this->addSql('COMMENT ON COLUMN given_answer.candidate_id IS \'(DC2Type:uuid)\''); + $this->addSql('COMMENT ON COLUMN given_answer.quiz_id IS \'(DC2Type:uuid)\''); + $this->addSql('COMMENT ON COLUMN given_answer.answer_id IS \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE answer_candidate ALTER answer_id TYPE UUID'); + $this->addSql('ALTER TABLE answer_candidate ALTER candidate_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN answer_candidate.answer_id IS \'(DC2Type:uuid)\''); + $this->addSql('COMMENT ON COLUMN answer_candidate.candidate_id IS \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE quiz DROP dropouts'); + $this->addSql('ALTER TABLE quiz ALTER id TYPE UUID'); + $this->addSql('ALTER TABLE quiz ALTER season_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN quiz.id IS \'(DC2Type:uuid)\''); + $this->addSql('COMMENT ON COLUMN quiz.season_id IS \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE season ALTER id TYPE UUID'); + $this->addSql('ALTER TABLE season ALTER active_quiz_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN season.id IS \'(DC2Type:uuid)\''); + $this->addSql('COMMENT ON COLUMN season.active_quiz_id IS \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE answer ALTER id TYPE UUID'); + $this->addSql('ALTER TABLE answer ALTER question_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN answer.id IS \'(DC2Type:uuid)\''); + $this->addSql('COMMENT ON COLUMN answer.question_id IS \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE season_user ALTER season_id TYPE UUID'); + $this->addSql('ALTER TABLE season_user ALTER user_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN season_user.season_id IS \'(DC2Type:uuid)\''); + $this->addSql('COMMENT ON COLUMN season_user.user_id IS \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE question ALTER id TYPE UUID'); + $this->addSql('ALTER TABLE question ALTER quiz_id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN question.id IS \'(DC2Type:uuid)\''); + $this->addSql('COMMENT ON COLUMN question.quiz_id IS \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE "user" ALTER id TYPE UUID'); + $this->addSql('COMMENT ON COLUMN "user".id IS \'(DC2Type:uuid)\''); + } +} diff --git a/src/Controller/BackofficeController.php b/src/Controller/BackofficeController.php new file mode 100644 index 0000000..fbd8999 --- /dev/null +++ b/src/Controller/BackofficeController.php @@ -0,0 +1,49 @@ +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, + ]); + } +} diff --git a/src/Controller/QuizController.php b/src/Controller/QuizController.php index e67dbfd..bf5e28c 100644 --- a/src/Controller/QuizController.php +++ b/src/Controller/QuizController.php @@ -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); } diff --git a/src/Entity/GivenAnswer.php b/src/Entity/GivenAnswer.php index 4d907d5..49fd04c 100644 --- a/src/Entity/GivenAnswer.php +++ b/src/Entity/GivenAnswer.php @@ -34,7 +34,7 @@ class GivenAnswer #[ORM\JoinColumn(nullable: true)] private ?Answer $answer = null; - #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: false)] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: false)] private \DateTimeInterface $created; public function getId(): ?Uuid @@ -78,7 +78,7 @@ class GivenAnswer return $this; } - public function getCreated(): ?\DateTimeInterface + public function getCreated(): \DateTimeInterface { return $this->created; } diff --git a/src/Entity/Quiz.php b/src/Entity/Quiz.php index 483dbac..06e3eb1 100644 --- a/src/Entity/Quiz.php +++ b/src/Entity/Quiz.php @@ -36,6 +36,9 @@ class Quiz #[ORM\OneToMany(targetEntity: Correction::class, mappedBy: 'quiz', orphanRemoval: true)] private Collection $corrections; + #[ORM\Column(nullable: true)] + private ?int $dropouts = null; + public function __construct() { $this->questions = new ArrayCollection(); @@ -102,4 +105,16 @@ class Quiz return $this; } + + public function getDropouts(): ?int + { + return $this->dropouts; + } + + public function setDropouts(?int $dropouts): static + { + $this->dropouts = $dropouts; + + return $this; + } } diff --git a/src/Repository/QuizRepository.php b/src/Repository/QuizRepository.php index 8d0421b..3f3ab79 100644 --- a/src/Repository/QuizRepository.php +++ b/src/Repository/QuizRepository.php @@ -17,4 +17,8 @@ class QuizRepository extends ServiceEntityRepository { parent::__construct($registry, Quiz::class); } + + public function quizReault(Quiz $quiz): array + { + } } diff --git a/templates/backoffice/base.html.twig b/templates/backoffice/base.html.twig new file mode 100644 index 0000000..aac28e1 --- /dev/null +++ b/templates/backoffice/base.html.twig @@ -0,0 +1,37 @@ + + + + + + + + + + {% block title %}Tijd voor de test{% endblock title %} + + {% block stylesheets %} + {% endblock %} + + {% block javascripts %} + {% endblock %} + + +{% block nav %} + {{ include('backoffice/nav.html.twig') }} +{% endblock nav %} +
+
+ {# {% include "messages.html" %} #} + {% block body %} + {% endblock body %} +
+
+ + diff --git a/templates/backoffice/index.html.twig b/templates/backoffice/index.html.twig new file mode 100644 index 0000000..8d07c20 --- /dev/null +++ b/templates/backoffice/index.html.twig @@ -0,0 +1,48 @@ +{% extends 'backoffice/base.html.twig' %} + +{% block title %}Hello BackofficeController!{% endblock %} + +{% block body %} +

{% trans %}Your Seasons{% endtrans %}

+ + + + + + + + + + + + {% for season in seasons %} + + + + + + + + {% else %} + EMPTY + {% endfor %} + +
{% trans %}Name{% endtrans %}{% trans %}Active Quiz{% endtrans %}{% trans %}Season Code{% endtrans %}{% trans %}Preregister?{% endtrans %}{% trans %}Manage{% endtrans %}
{{ season.name }} + {% if season.activeQuiz %} + {{ season.activeQuiz.name }} + {% else %} + {% trans %} No active quiz {% endtrans %} + {% endif %} + + {{ season.seasonCode }} + + + + {% trans %}Manage{% endtrans %} +
+{% endblock %} diff --git a/templates/backoffice/nav.html.twig b/templates/backoffice/nav.html.twig new file mode 100644 index 0000000..f45bb59 --- /dev/null +++ b/templates/backoffice/nav.html.twig @@ -0,0 +1,22 @@ + diff --git a/templates/backoffice/quiz.html.twig b/templates/backoffice/quiz.html.twig new file mode 100644 index 0000000..488b64a --- /dev/null +++ b/templates/backoffice/quiz.html.twig @@ -0,0 +1,95 @@ +{% extends 'backoffice/base.html.twig' %} + +{% block body %} +

+

{{ t('Quiz') }}: {{ quiz.season.name }} - {{ quiz.name }}

+

+
+

+

{{ t('Questions') }}

+

+
+ {% for question in quiz.questions %} +
+

+ +

+
+
+ {% for answer in question.answers %} +
  • {{ answer.text }}
  • + {% else %} + {{ t('There are no answers for this question') }} + {% endfor %} +
    +
    +
    + {% else %} + EMPTY + {% endfor %} +
    +
    +
    +

    +

    {{ t('Score') }}

    +

    + +

    {{ t('Number of dropouts:') }} {{ quiz.dropouts }}

    + + + + + + + + + + + + {# {% with result = quiz.get_score %} #} + {# {% for candidate in result %} #} + {# #} + {# #} + {# #} + {# #} + {# #} + {# #} + {# #} + {# {% empty %} #} + {# {% endfor %} #} + +
    {{ t('Candidate') }}{{ t('Correct Answers') }}{{ t('Corrections') }}{{ t('Score') }}{{ t('Time') }}
    {{ candidate.name }}{{ candidate.correct }}{{ candidate.corrections }}{{ candidate.score }}{{ candidate.time }}
    + {# {% endwith %} #} +
    +{% endblock %} +{% block script %} + +{% endblock script %} +{% block title %} + +{% endblock %} diff --git a/templates/backoffice/season.html.twig b/templates/backoffice/season.html.twig new file mode 100644 index 0000000..c62abc8 --- /dev/null +++ b/templates/backoffice/season.html.twig @@ -0,0 +1,26 @@ +{% extends 'backoffice/base.html.twig' %} +{% block body %} +

    +

    {{ t('Season') }}: {{ season.name }}

    +

    +
    +
    +

    {{ t('Quizzes') }}

    +
    + {% for quiz in season.quizzes %} + {{ quiz.name }} + {% else %} + No quizzes + {% endfor %} +
    +
    +
    +

    {{ t('Candidates') }}

    +
      + {% for candidate in season.candidates %} +
    • {{ candidate.name }}
    • {% endfor %} +
    +
    +
    +{% endblock body %} diff --git a/templates/base.html.twig b/templates/base.html.twig deleted file mode 100644 index 8b9aea3..0000000 --- a/templates/base.html.twig +++ /dev/null @@ -1,17 +0,0 @@ - - - - - {% block title %}Welcome!{% endblock %} - - {% block stylesheets %} - {% endblock %} - - {% block javascripts %} - {% endblock %} - - -{% block body %}{% endblock %} - - diff --git a/translations/messages+intl-icu.nl.xlf b/translations/messages+intl-icu.nl.xlf deleted file mode 100644 index edb51e7..0000000 --- a/translations/messages+intl-icu.nl.xlf +++ /dev/null @@ -1,14 +0,0 @@ - - - -
    - -
    - - - Enter your name - Voor je naam in - - -
    -
    diff --git a/translations/messages+intl-icu.nl.yaml b/translations/messages+intl-icu.nl.yaml new file mode 100644 index 0000000..604c258 --- /dev/null +++ b/translations/messages+intl-icu.nl.yaml @@ -0,0 +1,24 @@ +'Active Quiz': 'Actieve test' +Candidate: Kandidaat +Candidates: Kandidaten +'Correct Answers': 'Goede antwoorden' +Corrections: Jokers +'Enter your name': 'Voor je naam in' +'Load Prepared Elimination': 'Laad voorbereide eliminatie' +Manage: Beheren +Name: Naam +'No active quiz': 'Geen actieve test' +'Number of dropouts:': 'Aantal afvallers:' +'Prepare Custom Elimination': 'Bereid aangepaste eliminatie voor' +'Preregister?': 'Voorregistreren?' +Questions: Vragen +Quiz: Test +Quizzes: Tests +Score: Score +Season: Seizoen +'Season Code': Seizoenscode +Seasons: Seizoenen +'Start Elimination': 'Start eliminatie' +'There are no answers for this question': 'Er zijn geen antwoorden voor deze vraag' +Time: Tijd +'Your Seasons': 'Jouw seizoenen'