feat: Calculer automatiquement les moyennes après chaque saisie de notes
Some checks failed
CI / Backend Tests (push) Has been cancelled
CI / Frontend Tests (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Naming Conventions (push) Has been cancelled
CI / Build Check (push) Has been cancelled

Les enseignants ont besoin de moyennes à jour immédiatement après la
publication ou modification des notes, sans attendre un batch nocturne.

Le système recalcule via Domain Events synchrones : statistiques
d'évaluation (min/max/moyenne/médiane), moyennes matières pondérées
(normalisation /20), et moyenne générale par élève. Les résultats sont
stockés dans des tables dénormalisées avec cache Redis (TTL 5 min).

Trois endpoints API exposent les données avec contrôle d'accès par rôle.
Une commande console permet le backfill des données historiques au
déploiement.
This commit is contained in:
2026-03-30 06:22:03 +02:00
parent b70d5ec2ad
commit b7dc27f2a5
786 changed files with 118783 additions and 316 deletions

View File

@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace App\Scolarite\Application\Command\DeleteAppreciationTemplate;
final readonly class DeleteAppreciationTemplateCommand
{
public function __construct(
public string $tenantId,
public string $teacherId,
public string $templateId,
) {
}
}

View File

@@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
namespace App\Scolarite\Application\Command\DeleteAppreciationTemplate;
use App\Scolarite\Domain\Exception\AppreciationTemplateNonTrouveeException;
use App\Scolarite\Domain\Exception\NonProprietaireDuModeleException;
use App\Scolarite\Domain\Model\Grade\AppreciationTemplateId;
use App\Scolarite\Domain\Repository\AppreciationTemplateRepository;
use App\Shared\Domain\Tenant\TenantId;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
#[AsMessageHandler(bus: 'command.bus')]
final readonly class DeleteAppreciationTemplateHandler
{
public function __construct(
private AppreciationTemplateRepository $templateRepository,
) {
}
public function __invoke(DeleteAppreciationTemplateCommand $command): void
{
$tenantId = TenantId::fromString($command->tenantId);
$templateId = AppreciationTemplateId::fromString($command->templateId);
$template = $this->templateRepository->findById($templateId, $tenantId);
if ($template === null) {
throw AppreciationTemplateNonTrouveeException::withId($templateId);
}
if ((string) $template->teacherId !== $command->teacherId) {
throw NonProprietaireDuModeleException::withId($templateId);
}
$this->templateRepository->delete($templateId, $tenantId);
}
}