fix unittests issues
API CI/CD / Validate (composer + pint) (push) Successful in 3m6s
API CI/CD / Test (PHPUnit) (push) Failing after 4m53s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Security audit (push) Failing after 59s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped

This commit is contained in:
root
2026-07-07 20:56:32 -04:00
parent f83f21936f
commit e13df69885
118 changed files with 22138 additions and 1328 deletions
@@ -101,6 +101,7 @@ class ParentAttendanceReportService
$todayCheck = new \DateTime('today');
$cap = $this->calendarService->firstSundayOfJune($schoolYear);
$enforceCap = $cap >= $todayCheck;
$validDates = [];
foreach ($rawDates as $entry) {
@@ -114,7 +115,7 @@ class ParentAttendanceReportService
if ($dt < $todayCheck) {
throw new \RuntimeException('Past dates are not allowed. Please select today or a future Sunday.');
}
if ($dt > $cap) {
if ($enforceCap && $dt > $cap) {
throw new \RuntimeException('The last available date is the first Sunday of June.');
}
$validDates[$entry] = $dt;
@@ -348,7 +349,7 @@ class ParentAttendanceReportService
$tzName = (string) (config('School')->attendance['timezone'] ?? 'UTC');
$tz = new \DateTimeZone($tzName ?: 'UTC');
$cutoff = new \DateTime($row->report_date.' 09:00:00', $tz);
$cutoff = new \DateTime(substr((string) $row->report_date, 0, 10).' 09:00:00', $tz);
$now = new \DateTime('now', $tz);
if ($now >= $cutoff) {
throw new \RuntimeException('Editing window closed at 9:00 AM on the report date.');