update tests

This commit is contained in:
root
2026-06-08 22:06:30 -04:00
parent 79024235ef
commit 60ecacb7f8
54 changed files with 13243 additions and 5561 deletions
@@ -9,6 +9,7 @@ use App\Models\TeacherClass;
use Carbon\Carbon;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use RuntimeException;
class TeacherAttendanceSubmissionService
@@ -171,6 +172,20 @@ class TeacherAttendanceSubmissionService
$position = strtolower((string)($teacher['position'] ?? 'main'));
$position = $position === 'ta' ? 'ta' : 'main';
$staffPayload = [
'role_name' => 'Teacher',
'status' => strtolower((string)($teachersData[$teacherId]['status'] ?? 'present')),
'reason' => ($teachersData[$teacherId]['reason'] ?? null) ?: null,
'updated_at' => now(),
'created_at' => now(),
];
if (Schema::hasColumn('staff_attendance', 'class_section_id')) {
$staffPayload['class_section_id'] = $classSectionId;
}
if (Schema::hasColumn('staff_attendance', 'position')) {
$staffPayload['position'] = $position;
}
DB::table('staff_attendance')->updateOrInsert(
[
'user_id' => $teacherId,
@@ -178,15 +193,7 @@ class TeacherAttendanceSubmissionService
'semester' => $semester,
'school_year' => $schoolYear,
],
[
'role_name' => 'Teacher',
'class_section_id' => $classSectionId,
'position' => $position,
'status' => strtolower((string)($teachersData[$teacherId]['status'] ?? 'present')),
'reason' => ($teachersData[$teacherId]['reason'] ?? null) ?: null,
'updated_at' => now(),
'created_at' => now(),
]
$staffPayload
);
}