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
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:
@@ -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.');
|
||||
|
||||
Reference in New Issue
Block a user