fix unit tests as well as missing code
API CI/CD / Validate (composer + pint) (push) Successful in 2m7s
API CI/CD / Test (PHPUnit) (push) Failing after 2m23s
API CI/CD / Build frontend assets (push) Successful in 2m18s
API CI/CD / Security audit (push) Successful in 31s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped

This commit is contained in:
root
2026-06-25 14:26:32 -04:00
parent fdfcd1f0e2
commit 940afe9319
115 changed files with 4554 additions and 290 deletions
@@ -13,6 +13,7 @@ use App\Models\Student;
use App\Models\StudentClass;
use App\Models\TeacherClass;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class ReportCardService
{
@@ -105,8 +106,9 @@ class ReportCardService
$students = [];
try {
$classSectionNameSql = $this->classSectionNameAggregateSql();
$builder = DB::table('semester_scores as ss')
->select('s.id', 's.firstname', 's.lastname', DB::raw('GROUP_CONCAT(DISTINCT cs.class_section_name ORDER BY cs.class_section_name SEPARATOR ", ") AS class_section_name'))
->select('s.id', 's.firstname', 's.lastname', DB::raw($classSectionNameSql.' AS class_section_name'))
->join('students as s', 's.id', '=', 'ss.student_id')
->leftJoin('student_class as sc', function ($join) {
$join->on('sc.student_id', '=', 's.id')
@@ -133,7 +135,7 @@ class ReportCardService
}
if (empty($students)) {
$fallback = Student::query()
->select('students.id', 'students.firstname', 'students.lastname', DB::raw('GROUP_CONCAT(DISTINCT cs.class_section_name ORDER BY cs.class_section_name SEPARATOR ", ") AS class_section_name'))
->select('students.id', 'students.firstname', 'students.lastname', DB::raw($classSectionNameSql.' AS class_section_name'))
->leftJoin('student_class as sc', 'sc.student_id', '=', 'students.id')
->leftJoin('classSection as cs', 'cs.class_section_id', '=', 'sc.class_section_id');
if ($year !== '') {
@@ -643,6 +645,10 @@ class ReportCardService
];
foreach ($tables as [$table, $pk]) {
if (! Schema::hasTable($table)) {
continue;
}
$result = DB::table($table)
->select('class_section_name')
->where($pk, $classId)
@@ -1622,4 +1628,13 @@ class ReportCardService
return null;
}
private function classSectionNameAggregateSql(): string
{
if (DB::connection()->getDriverName() === 'sqlite') {
return 'GROUP_CONCAT(DISTINCT cs.class_section_name)';
}
return 'GROUP_CONCAT(DISTINCT cs.class_section_name ORDER BY cs.class_section_name SEPARATOR ", ")';
}
}