add test batches
This commit is contained in:
@@ -15,7 +15,8 @@ class AdministratorEnrollmentStatusService
|
||||
protected User $userModel,
|
||||
protected AdministratorEnrollmentRefundService $refundService,
|
||||
protected AdministratorEnrollmentEventService $eventService,
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
public function updateStatuses(array $enrollmentStatuses, int $editorUserId): array
|
||||
{
|
||||
@@ -52,9 +53,8 @@ class AdministratorEnrollmentStatusService
|
||||
foreach ($enrollmentStatuses as $studentId => $newEnrollmentStatus) {
|
||||
$studentId = (int) $studentId;
|
||||
|
||||
if (! in_array($newEnrollmentStatus, $validStatuses, true)) {
|
||||
if (!in_array($newEnrollmentStatus, $validStatuses, true)) {
|
||||
$errors[] = "Invalid enrollment status '{$newEnrollmentStatus}' for student ID {$studentId}.";
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ class AdministratorEnrollmentStatusService
|
||||
$refundParents
|
||||
);
|
||||
|
||||
if (! $result['success']) {
|
||||
if (!$result['success']) {
|
||||
$errors[] = $result['message'];
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ class AdministratorEnrollmentStatusService
|
||||
];
|
||||
} catch (\Throwable $e) {
|
||||
DB::rollBack();
|
||||
Log::error('Enrollment withdrawal error: '.$e->getMessage());
|
||||
Log::error('Enrollment withdrawal error: ' . $e->getMessage());
|
||||
|
||||
return [
|
||||
'success' => false,
|
||||
@@ -129,7 +129,7 @@ class AdministratorEnrollmentStatusService
|
||||
->where('school_year', $schoolYear)
|
||||
->first();
|
||||
|
||||
if (! $enrollmentRow) {
|
||||
if (!$enrollmentRow) {
|
||||
return $this->createEnrollmentRow(
|
||||
$studentId,
|
||||
$newEnrollmentStatus,
|
||||
@@ -145,7 +145,7 @@ class AdministratorEnrollmentStatusService
|
||||
$oldStatus = $enrollmentRow->enrollment_status ?? null;
|
||||
$parentId = (int) ($enrollmentRow->parent_id ?? 0);
|
||||
|
||||
if (! $parentId) {
|
||||
if (!$parentId) {
|
||||
return [
|
||||
'success' => false,
|
||||
'message' => "No parent ID found for student ID {$studentId}.",
|
||||
@@ -165,7 +165,7 @@ class AdministratorEnrollmentStatusService
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
if (! $updated) {
|
||||
if (!$updated) {
|
||||
return [
|
||||
'success' => false,
|
||||
'message' => "Failed to update enrollment for student ID {$studentId}.",
|
||||
@@ -201,7 +201,7 @@ class AdministratorEnrollmentStatusService
|
||||
$stu = is_array($stu) ? $stu : ($stu?->toArray() ?? []);
|
||||
|
||||
$parentId = (int) ($stu['parent_id'] ?? ($stu['secondparent_user_id'] ?? 0));
|
||||
if (! $parentId) {
|
||||
if (!$parentId) {
|
||||
return [
|
||||
'success' => false,
|
||||
'message' => "No parent ID found for student ID {$studentId}.",
|
||||
@@ -223,7 +223,7 @@ class AdministratorEnrollmentStatusService
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
if (! $ok) {
|
||||
if (!$ok) {
|
||||
return [
|
||||
'success' => false,
|
||||
'message' => "Failed to create enrollment for student ID {$studentId}.",
|
||||
@@ -250,7 +250,7 @@ class AdministratorEnrollmentStatusService
|
||||
$studentRow = $this->studentModel->find($studentId);
|
||||
$studentData = is_array($studentRow) ? $studentRow : ($studentRow?->toArray() ?? []);
|
||||
|
||||
return trim(($studentData['firstname'] ?? '').' '.($studentData['lastname'] ?? ''))
|
||||
return trim(($studentData['firstname'] ?? '') . ' ' . ($studentData['lastname'] ?? ''))
|
||||
?: "Student #{$studentId}";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user