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
View File
@@ -6,6 +6,7 @@ use App\Models\GradingLock;
use App\Models\MissingScoreOverride;
use App\Models\Student;
use App\Models\TeacherClass;
use App\Models\ClassSection;
use Illuminate\Support\Facades\DB;
class ExamScoreService
@@ -79,6 +80,7 @@ class ExamScoreService
return [
'students' => $rows,
'classSectionName' => (string) (ClassSection::query()->where('class_section_id', $classSectionId)->value('class_section_name') ?? ''),
'semester' => $semester,
'schoolYear' => $schoolYear,
'scoresLocked' => GradingLock::isLocked($classSectionId, $semester, $schoolYear),
@@ -8,6 +8,7 @@ use App\Models\MissingScoreOverride;
use App\Models\Student;
use App\Models\StudentClass;
use App\Models\TeacherClass;
use App\Models\ClassSection;
class HomeworkScoreService
{
@@ -84,6 +85,7 @@ class HomeworkScoreService
->get()
->map(fn ($row) => [
'student_id' => (int) $row->id,
'school_id' => (string) $row->school_id,
'firstname' => (string) $row->firstname,
'lastname' => (string) $row->lastname,
'scores' => [],
@@ -115,6 +117,7 @@ class HomeworkScoreService
return [
'students' => $students,
'headers' => $headers,
'classSectionName' => (string) (ClassSection::query()->where('class_section_id', $classSectionId)->value('class_section_name') ?? ''),
'semester' => $semester,
'schoolYear' => $schoolYear,
'scoresLocked' => $this->isLockedForAnySchoolYear($classSectionId, $semester, $schoolYearVariants),
@@ -3,6 +3,7 @@
namespace App\Services\Scores;
use App\Models\GradingLock;
use App\Models\ClassSection;
use App\Models\MissingScoreOverride;
use App\Models\Participation;
use App\Models\Student;
@@ -95,6 +96,7 @@ class ParticipationScoreService
return [
'students' => $students,
'classSectionName' => (string) (ClassSection::query()->where('class_section_id', $classSectionId)->value('class_section_name') ?? ''),
'semester' => $semester,
'schoolYear' => $schoolYear,
'scoresLocked' => GradingLock::isLocked($classSectionId, $semester, $schoolYear),
@@ -8,6 +8,7 @@ use App\Models\Project;
use App\Models\Student;
use App\Models\StudentClass;
use App\Models\TeacherClass;
use App\Models\ClassSection;
use Illuminate\Support\Facades\DB;
class ProjectScoreService
@@ -76,6 +77,7 @@ class ProjectScoreService
->get()
->map(fn ($row) => [
'student_id' => (int) $row->id,
'school_id' => (string) $row->school_id,
'firstname' => (string) $row->firstname,
'lastname' => (string) $row->lastname,
'scores' => [],
@@ -107,6 +109,7 @@ class ProjectScoreService
return [
'students' => $students,
'headers' => $headers,
'classSectionName' => (string) (ClassSection::query()->where('class_section_id', $classSectionId)->value('class_section_name') ?? ''),
'semester' => $semester,
'schoolYear' => $schoolYear,
'scoresLocked' => GradingLock::isLocked($classSectionId, $semester, $schoolYear),
+3
View File
@@ -8,6 +8,7 @@ use App\Models\Quiz;
use App\Models\Student;
use App\Models\StudentClass;
use App\Models\TeacherClass;
use App\Models\ClassSection;
class QuizScoreService
{
@@ -75,6 +76,7 @@ class QuizScoreService
->get()
->map(fn ($row) => [
'student_id' => (int) $row->id,
'school_id' => (string) $row->school_id,
'firstname' => (string) $row->firstname,
'lastname' => (string) $row->lastname,
'scores' => [],
@@ -106,6 +108,7 @@ class QuizScoreService
return [
'students' => $students,
'headers' => $headers,
'classSectionName' => (string) (ClassSection::query()->where('class_section_id', $classSectionId)->value('class_section_name') ?? ''),
'semester' => $semester,
'schoolYear' => $schoolYear,
'scoresLocked' => GradingLock::isLocked($classSectionId, $semester, $schoolYear),
@@ -3,6 +3,7 @@
namespace App\Services\Scores;
use App\Models\Configuration;
use App\Models\ClassSection;
use App\Models\GradingLock;
use App\Models\MissingScoreOverride;
use App\Models\ScoreComment;
@@ -111,6 +112,9 @@ class ScoreCommentService
'semester' => $activeSemester,
'schoolYear' => $schoolYear,
'classSectionId' => $isAllSections ? 'allsections' : $classSectionInt,
'classSectionName' => (!$isAllSections && $classSectionInt)
? (string) (ClassSection::query()->where('class_section_id', $classSectionInt)->value('class_section_name') ?? '')
: '',
'scoresLocked' => (!$isAllSections && $classSectionInt)
? GradingLock::isLocked($classSectionInt, $activeSemester, $schoolYear)
: false,
@@ -9,11 +9,14 @@ class ScorePredictorDataService
public function classSections(string $schoolYear): array
{
return DB::table('classSection as cs')
->select('cs.*')
->select([
'cs.class_section_id',
'cs.class_section_name',
])
->join('student_class as sc', 'sc.class_section_id', '=', 'cs.class_section_id')
->where('sc.school_year', $schoolYear)
->where('cs.class_section_name', 'not like', 'KG%')
->groupBy('cs.id')
->distinct()
->orderBy('cs.class_section_name', 'ASC')
->get()
->map(fn ($row) => (array) $row)
@@ -28,9 +31,9 @@ class ScorePredictorDataService
's.school_id',
's.firstname',
's.lastname',
'fall.semester_score as fall_score',
'spring.semester_score as spring_score',
'sc.class_section_id as class_section_id',
DB::raw('MAX(fall.semester_score) as fall_score'),
DB::raw('MAX(spring.semester_score) as spring_score'),
DB::raw('MAX(sc.class_section_id) as class_section_id'),
])
->leftJoin('student_class as sc', function ($join) use ($schoolYear) {
$join->on('sc.student_id', '=', 's.id')
@@ -58,7 +61,7 @@ class ScorePredictorDataService
}
return $builder
->groupBy('s.id')
->groupBy('s.id', 's.school_id', 's.firstname', 's.lastname')
->get()
->map(fn ($row) => (array) $row)
->all();