fix school year and related issues
Tests / PHPUnit (push) Failing after 34s

This commit is contained in:
root
2026-07-30 00:48:54 -04:00
parent f8f00c70c8
commit 81a72a4c59
27 changed files with 1512 additions and 52 deletions
+12 -2
View File
@@ -129,11 +129,21 @@ final class SchoolYearContextService
{
$active = $this->schoolYearModel->active();
if ($active === null) {
if ($active !== null) {
return $this->fromRow($active, false);
}
$closing = $this->schoolYearModel
->where('status', SchoolYearStatus::CLOSING)
->orderBy('closing_started_at', 'DESC')
->orderBy('id', 'DESC')
->findAll(2);
if (count($closing) !== 1) {
throw new SchoolYearConfigurationException('Exactly one active school year must be configured.');
}
return $this->fromRow($active, false);
return $this->fromRow($closing[0], false);
}
private function normalizeInt(mixed $value): ?int