add grading, attendnace management

This commit is contained in:
root
2026-04-29 17:39:33 -04:00
parent 8beeed883f
commit df5266c5b5
27 changed files with 386 additions and 157 deletions
@@ -2,6 +2,7 @@
namespace App\Services\Attendance;
use App\Models\Configuration;
use Carbon\Carbon;
class SemesterRangeService
@@ -19,6 +20,16 @@ class SemesterRangeService
public function getSchoolYearRange(string $schoolYear): array
{
$fallStart = Configuration::getConfig('fall_semester_start');
$lastDay = Configuration::getConfig('last_school_day');
if ($fallStart && $lastDay) {
return [
Carbon::parse($fallStart)->toDateString(),
Carbon::parse($lastDay)->toDateString(),
];
}
[$startYear, $endYear] = $this->parseSchoolYear($schoolYear);
return [
@@ -29,9 +40,29 @@ class SemesterRangeService
public function getSemesterRange(string $schoolYear, string $semester): ?array
{
[$startYear, $endYear] = $this->parseSchoolYear($schoolYear);
$semester = $this->normalizeSemester($semester);
$fallStart = Configuration::getConfig('fall_semester_start');
$springStart = Configuration::getConfig('spring_semester_start');
$lastDay = Configuration::getConfig('last_school_day');
if ($semester === 'Fall' && $fallStart && $springStart) {
return [
Carbon::parse($fallStart)->toDateString(),
Carbon::parse($springStart)->subDay()->toDateString(),
];
}
if ($semester === 'Spring' && $springStart && $lastDay) {
return [
Carbon::parse($springStart)->toDateString(),
Carbon::parse($lastDay)->toDateString(),
];
}
// Fallback to hardcoded logic when config keys are missing
[$startYear, $endYear] = $this->parseSchoolYear($schoolYear);
return match ($semester) {
'Fall' => [
Carbon::create($startYear, 9, 21)->toDateString(),