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 aedde6707e
694 changed files with 109792 additions and 75 deletions

View File

@@ -39,6 +39,11 @@ framework:
adapter: cache.adapter.filesystem
default_lifetime: 604800 # 7 jours
# Pool dédié aux moyennes élèves et statistiques (5 min TTL)
student_averages.cache:
adapter: cache.adapter.filesystem
default_lifetime: 300 # 5 minutes
# Pool dédié au cache des requêtes paginées (1h TTL, tag-aware)
paginated_queries.cache:
adapter: cache.adapter.filesystem
@@ -79,6 +84,10 @@ when@test:
adapter: cache.adapter.redis
provider: '%env(REDIS_URL)%'
default_lifetime: 604800
student_averages.cache:
adapter: cache.adapter.redis
provider: '%env(REDIS_URL)%'
default_lifetime: 300
paginated_queries.cache:
adapter: cache.adapter.redis_tag_aware
provider: '%env(REDIS_URL)%'
@@ -120,6 +129,10 @@ when@prod:
adapter: cache.adapter.redis
provider: '%env(REDIS_URL)%'
default_lifetime: 604800 # 7 jours
student_averages.cache:
adapter: cache.adapter.redis
provider: '%env(REDIS_URL)%'
default_lifetime: 300 # 5 minutes
paginated_queries.cache:
adapter: cache.adapter.redis_tag_aware
provider: '%env(REDIS_URL)%'

View File

@@ -268,6 +268,38 @@ services:
App\Scolarite\Application\Port\EvaluationGradesChecker:
alias: App\Scolarite\Infrastructure\Service\NoGradesEvaluationGradesChecker
# Averages (Story 6.3 - Calcul automatique des moyennes)
App\Scolarite\Domain\Service\AverageCalculator:
autowire: true
App\Scolarite\Application\Service\RecalculerMoyennesService:
autowire: true
App\Scolarite\Application\Port\PeriodFinder:
alias: App\Scolarite\Infrastructure\Service\DoctrinePeriodFinder
App\Scolarite\Infrastructure\Persistence\Doctrine\DoctrineEvaluationStatisticsRepository:
autowire: true
App\Scolarite\Infrastructure\Cache\CachingEvaluationStatisticsRepository:
arguments:
$inner: '@App\Scolarite\Infrastructure\Persistence\Doctrine\DoctrineEvaluationStatisticsRepository'
$cache: '@student_averages.cache'
App\Scolarite\Domain\Repository\EvaluationStatisticsRepository:
alias: App\Scolarite\Infrastructure\Cache\CachingEvaluationStatisticsRepository
App\Scolarite\Infrastructure\Persistence\Doctrine\DoctrineStudentAverageRepository:
autowire: true
App\Scolarite\Infrastructure\Cache\CachingStudentAverageRepository:
arguments:
$inner: '@App\Scolarite\Infrastructure\Persistence\Doctrine\DoctrineStudentAverageRepository'
$cache: '@student_averages.cache'
App\Scolarite\Domain\Repository\StudentAverageRepository:
alias: App\Scolarite\Infrastructure\Cache\CachingStudentAverageRepository
# Super Admin Repositories (Story 2.10 - Multi-établissements)
App\SuperAdmin\Domain\Repository\SuperAdminRepository:
alias: App\SuperAdmin\Infrastructure\Persistence\Doctrine\DoctrineSuperAdminRepository