From 40a5fcc1fa3eaccf7a0cd3dcc47621d86854fc92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Sun, 23 Jun 2024 18:48:42 +0200 Subject: [PATCH] feat: remove unused assignment status, rename 'open' to 'published' --- migrations/Version20240623164458.php | 29 +++++++++++++++++++ src/Entity/Assignment.php | 3 +- src/Form/AssignmentType.php | 3 +- src/Repository/AssignmentRepository.php | 2 +- src/Security/Voter/AssignmentVoter.php | 4 +-- .../administrative/assignment/index.html.twig | 8 ----- 6 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 migrations/Version20240623164458.php diff --git a/migrations/Version20240623164458.php b/migrations/Version20240623164458.php new file mode 100644 index 0000000..29bfd45 --- /dev/null +++ b/migrations/Version20240623164458.php @@ -0,0 +1,29 @@ +connection->executeQuery('update assignment set status=? where status=?', ['published', 'open']); + } + + public function down(Schema $schema): void + { + $this->connection->executeQuery('update assignment set status=? where status=?', ['open', 'published']); + } +} diff --git a/src/Entity/Assignment.php b/src/Entity/Assignment.php index a676362..b855432 100644 --- a/src/Entity/Assignment.php +++ b/src/Entity/Assignment.php @@ -22,8 +22,7 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa use SoftDeletableEntity; public const STATUS_DRAFT = 'draft'; - public const STATUS_OPEN = 'open'; - public const STATUS_CLOSED = 'closed'; + public const STATUS_PUBLISHED = 'published'; public const STATUS_STAFFED = 'staffed'; public const STATUS_PARTLY_STAFFED = 'partly_staffed'; diff --git a/src/Form/AssignmentType.php b/src/Form/AssignmentType.php index dfb87e0..5795090 100644 --- a/src/Form/AssignmentType.php +++ b/src/Form/AssignmentType.php @@ -36,8 +36,7 @@ class AssignmentType extends AbstractType 'label' => 'Status', 'choices' => [ 'Entwurf' => Assignment::STATUS_DRAFT, - 'offen' => Assignment::STATUS_OPEN, - 'geschlossen' => Assignment::STATUS_CLOSED, + 'veröffentlicht' => Assignment::STATUS_PUBLISHED, ], ]) ->add('availableDispositions', IntegerType::class, [ diff --git a/src/Repository/AssignmentRepository.php b/src/Repository/AssignmentRepository.php index 746d5da..e615485 100644 --- a/src/Repository/AssignmentRepository.php +++ b/src/Repository/AssignmentRepository.php @@ -286,7 +286,7 @@ class AssignmentRepository extends ServiceEntityRepository $qb->expr()->gt('destination.dateFrom', ':dateFrom') ) )) - ->setParameter('status', Assignment::STATUS_OPEN) + ->setParameter('status', Assignment::STATUS_PUBLISHED) ->setParameter('jobProfiles', $teamer->getJobProfiles()) ->setParameter('teamer', $teamer) ->setParameter('dateFrom', new \DateTimeImmutable()) diff --git a/src/Security/Voter/AssignmentVoter.php b/src/Security/Voter/AssignmentVoter.php index ca6ac1d..0737ca0 100644 --- a/src/Security/Voter/AssignmentVoter.php +++ b/src/Security/Voter/AssignmentVoter.php @@ -47,8 +47,8 @@ class AssignmentVoter extends Voter return $this->security->isGranted('ROLE_ADMINISTRATIVE'); } - // Only allow applications to open assignments - if (Assignment::STATUS_CLOSED === $assignment->getStatus()) { + // Only allow applications to published assignments + if (Assignment::STATUS_DRAFT === $assignment->getStatus()) { return false; } diff --git a/templates/administrative/assignment/index.html.twig b/templates/administrative/assignment/index.html.twig index 901dc09..b8ae1c5 100644 --- a/templates/administrative/assignment/index.html.twig +++ b/templates/administrative/assignment/index.html.twig @@ -66,9 +66,6 @@
{% if assignment.status == 'draft' %} - - - {{ icon('edit', 'w-4 h-4') }} {% else %} {% if assignment.staffed %} @@ -88,11 +85,6 @@ {% endif %} - {% if assignment.status == 'closed' %} - {{ icon('locked', 'w-4 h-4 text-red-500') }} - {% else %} - {{ icon('unlocked', 'w-4 h-4') }} - {% endif %} {% endif %}