fix gitlab tests

This commit is contained in:
root
2026-06-09 02:32:58 -04:00
parent 20a0b6c4e5
commit 6def9993da
1489 changed files with 10449 additions and 11356 deletions
@@ -8,7 +8,9 @@ use App\Models\User;
class TeacherAssignmentService
{
public function __construct(private TeacherConfigService $configService) {}
public function __construct(private TeacherConfigService $configService)
{
}
public function listAssignments(?string $schoolYear = null): array
{
@@ -51,7 +53,7 @@ class TeacherAssignmentService
}
$role = strtolower((string) ($assign['position'] ?? ''));
if (! in_array($role, ['main', 'ta'], true)) {
if (!in_array($role, ['main', 'ta'], true)) {
continue;
}
@@ -71,9 +73,9 @@ class TeacherAssignmentService
continue;
}
$assigned = $assignmentMap[$tid] ?? ['main' => [], 'ta' => []];
$name = trim(($teacher['firstname'] ?? '').' '.($teacher['lastname'] ?? ''));
$name = trim(($teacher['firstname'] ?? '') . ' ' . ($teacher['lastname'] ?? ''));
if ($name === '') {
$name = 'User#'.$tid;
$name = 'User#' . $tid;
}
$teacherData[] = [
@@ -168,7 +170,7 @@ class TeacherAssignmentService
$semester = trim((string) ($input['semester'] ?? $context['semester'] ?? ''));
$schoolYear = trim((string) ($input['school_year'] ?? $context['school_year'] ?? ''));
if ($teacherId <= 0 || $classSectionId <= 0 || ! in_array($position, ['main', 'ta'], true) || $schoolYear === '' || $semester === '') {
if ($teacherId <= 0 || $classSectionId <= 0 || !in_array($position, ['main', 'ta'], true) || $schoolYear === '' || $semester === '') {
return ['ok' => false, 'message' => 'Missing or invalid data for deletion.'];
}
@@ -180,12 +182,12 @@ class TeacherAssignmentService
->where('position', $position)
->first();
if (! $assignment) {
if (!$assignment) {
return ['ok' => false, 'message' => 'Assignment not found.'];
}
$assignment->delete();
return ['ok' => true, 'message' => ucfirst($position).' assignment removed successfully.'];
return ['ok' => true, 'message' => ucfirst($position) . ' assignment removed successfully.'];
}
}