feat: remove unused assignment status, rename 'open' to 'published'

This commit is contained in:
Björn Fromme
2024-06-23 18:48:42 +02:00
parent 4ac8f36589
commit 40a5fcc1fa
6 changed files with 34 additions and 15 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240623164458 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->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']);
}
}
+1 -2
View File
@@ -22,8 +22,7 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
use SoftDeletableEntity; use SoftDeletableEntity;
public const STATUS_DRAFT = 'draft'; public const STATUS_DRAFT = 'draft';
public const STATUS_OPEN = 'open'; public const STATUS_PUBLISHED = 'published';
public const STATUS_CLOSED = 'closed';
public const STATUS_STAFFED = 'staffed'; public const STATUS_STAFFED = 'staffed';
public const STATUS_PARTLY_STAFFED = 'partly_staffed'; public const STATUS_PARTLY_STAFFED = 'partly_staffed';
+1 -2
View File
@@ -36,8 +36,7 @@ class AssignmentType extends AbstractType
'label' => 'Status', 'label' => 'Status',
'choices' => [ 'choices' => [
'Entwurf' => Assignment::STATUS_DRAFT, 'Entwurf' => Assignment::STATUS_DRAFT,
'offen' => Assignment::STATUS_OPEN, 'veröffentlicht' => Assignment::STATUS_PUBLISHED,
'geschlossen' => Assignment::STATUS_CLOSED,
], ],
]) ])
->add('availableDispositions', IntegerType::class, [ ->add('availableDispositions', IntegerType::class, [
+1 -1
View File
@@ -286,7 +286,7 @@ class AssignmentRepository extends ServiceEntityRepository
$qb->expr()->gt('destination.dateFrom', ':dateFrom') $qb->expr()->gt('destination.dateFrom', ':dateFrom')
) )
)) ))
->setParameter('status', Assignment::STATUS_OPEN) ->setParameter('status', Assignment::STATUS_PUBLISHED)
->setParameter('jobProfiles', $teamer->getJobProfiles()) ->setParameter('jobProfiles', $teamer->getJobProfiles())
->setParameter('teamer', $teamer) ->setParameter('teamer', $teamer)
->setParameter('dateFrom', new \DateTimeImmutable()) ->setParameter('dateFrom', new \DateTimeImmutable())
+2 -2
View File
@@ -47,8 +47,8 @@ class AssignmentVoter extends Voter
return $this->security->isGranted('ROLE_ADMINISTRATIVE'); return $this->security->isGranted('ROLE_ADMINISTRATIVE');
} }
// Only allow applications to open assignments // Only allow applications to published assignments
if (Assignment::STATUS_CLOSED === $assignment->getStatus()) { if (Assignment::STATUS_DRAFT === $assignment->getStatus()) {
return false; return false;
} }
@@ -66,9 +66,6 @@
<td> <td>
<div class="flex flex-col items-center space-y-2"> <div class="flex flex-col items-center space-y-2">
{% if assignment.status == 'draft' %} {% if assignment.status == 'draft' %}
<svg viewBox="0 0 5 5" class="h-4 w-4 fill-current text-gray-100">
<circle cx="3" cy="3" r="2" />
</svg>
{{ icon('edit', 'w-4 h-4') }} {{ icon('edit', 'w-4 h-4') }}
{% else %} {% else %}
{% if assignment.staffed %} {% if assignment.staffed %}
@@ -88,11 +85,6 @@
<circle cx="3" cy="3" r="2" /> <circle cx="3" cy="3" r="2" />
</svg> </svg>
{% endif %} {% endif %}
{% if assignment.status == 'closed' %}
{{ icon('locked', 'w-4 h-4 text-red-500') }}
{% else %}
{{ icon('unlocked', 'w-4 h-4') }}
{% endif %}
{% endif %} {% endif %}
</div> </div>
</td> </td>