feat: Permettre à l'élève de consulter ses notes et moyennes
L'élève avait accès à ses compétences mais pas à ses notes numériques. Cette fonctionnalité lui donne une vue complète de sa progression scolaire avec moyennes par matière, détail par évaluation, statistiques de classe, et un mode "découverte" pour révéler ses notes à son rythme (FR14, FR15). Les notes ne sont visibles qu'après publication par l'enseignant, ce qui garantit que l'élève les découvre avant ses parents (délai 24h story 6.7).
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Unit\Scolarite\Application\Query\GetChildrenGrades;
|
||||
|
||||
use App\Administration\Domain\Model\SchoolClass\ClassId;
|
||||
use App\Administration\Domain\Model\Subject\SubjectId;
|
||||
use App\Administration\Domain\Model\User\UserId;
|
||||
use App\Scolarite\Domain\Model\Evaluation\Coefficient;
|
||||
use App\Scolarite\Domain\Model\Evaluation\Evaluation;
|
||||
use App\Scolarite\Domain\Model\Evaluation\GradeScale;
|
||||
use App\Scolarite\Domain\Model\Grade\Grade;
|
||||
use App\Scolarite\Domain\Model\Grade\GradeStatus;
|
||||
use App\Scolarite\Domain\Model\Grade\GradeValue;
|
||||
use App\Scolarite\Infrastructure\Persistence\InMemory\InMemoryEvaluationRepository;
|
||||
use App\Scolarite\Infrastructure\Persistence\InMemory\InMemoryGradeRepository;
|
||||
use App\Shared\Domain\Tenant\TenantId;
|
||||
use DateTimeImmutable;
|
||||
|
||||
trait ParentGradeTestHelper
|
||||
{
|
||||
abstract protected function evaluationRepository(): InMemoryEvaluationRepository;
|
||||
|
||||
abstract protected function gradeRepository(): InMemoryGradeRepository;
|
||||
|
||||
private function givenPublishedEvaluation(
|
||||
string $title,
|
||||
string $publishedAt,
|
||||
string $classId = self::CLASS_A_ID,
|
||||
string $subjectId = self::SUBJECT_MATH_ID,
|
||||
string $evaluationDate = '2026-04-01',
|
||||
float $coefficient = 1.0,
|
||||
): Evaluation {
|
||||
$evaluation = Evaluation::creer(
|
||||
tenantId: TenantId::fromString(self::TENANT_ID),
|
||||
classId: ClassId::fromString($classId),
|
||||
subjectId: SubjectId::fromString($subjectId),
|
||||
teacherId: UserId::fromString(self::TEACHER_ID),
|
||||
title: $title,
|
||||
description: null,
|
||||
evaluationDate: new DateTimeImmutable($evaluationDate),
|
||||
gradeScale: new GradeScale(20),
|
||||
coefficient: new Coefficient($coefficient),
|
||||
now: new DateTimeImmutable('2026-03-25 08:00:00'),
|
||||
);
|
||||
|
||||
$evaluation->publierNotes(new DateTimeImmutable($publishedAt));
|
||||
$this->evaluationRepository()->save($evaluation);
|
||||
|
||||
return $evaluation;
|
||||
}
|
||||
|
||||
private function givenGrade(
|
||||
Evaluation $evaluation,
|
||||
string $studentId,
|
||||
float $value,
|
||||
): Grade {
|
||||
$grade = Grade::saisir(
|
||||
tenantId: $evaluation->tenantId,
|
||||
evaluationId: $evaluation->id,
|
||||
studentId: UserId::fromString($studentId),
|
||||
value: new GradeValue($value),
|
||||
status: GradeStatus::GRADED,
|
||||
gradeScale: $evaluation->gradeScale,
|
||||
createdBy: UserId::fromString(self::TEACHER_ID),
|
||||
now: new DateTimeImmutable('2026-03-26 10:00:00'),
|
||||
);
|
||||
|
||||
$this->gradeRepository()->save($grade);
|
||||
|
||||
return $grade;
|
||||
}
|
||||
|
||||
private function givenGradeWithStatus(
|
||||
Evaluation $evaluation,
|
||||
string $studentId,
|
||||
GradeStatus $status,
|
||||
): Grade {
|
||||
$grade = Grade::saisir(
|
||||
tenantId: $evaluation->tenantId,
|
||||
evaluationId: $evaluation->id,
|
||||
studentId: UserId::fromString($studentId),
|
||||
value: null,
|
||||
status: $status,
|
||||
gradeScale: $evaluation->gradeScale,
|
||||
createdBy: UserId::fromString(self::TEACHER_ID),
|
||||
now: new DateTimeImmutable('2026-03-26 10:00:00'),
|
||||
);
|
||||
|
||||
$this->gradeRepository()->save($grade);
|
||||
|
||||
return $grade;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user