Fix Laravel Pint formatting
This commit is contained in:
@@ -14,7 +14,7 @@ class GradingPlacementService
|
||||
{
|
||||
public function placementContext(?int $classSectionId, string $schoolYear, ?string $placementTest, ?string $open): array
|
||||
{
|
||||
if (!$classSectionId) {
|
||||
if (! $classSectionId) {
|
||||
$showStudents = ($placementTest !== '' && $open === '1');
|
||||
$students = $showStudents ? $this->fetchActiveStudentsWithSection($schoolYear) : [];
|
||||
$batches = $this->fetchPlacementBatches($schoolYear);
|
||||
@@ -40,7 +40,7 @@ class GradingPlacementService
|
||||
), static fn ($id) => $id > 0));
|
||||
|
||||
$levels = [];
|
||||
if (!empty($studentIds)) {
|
||||
if (! empty($studentIds)) {
|
||||
$rows = PlacementLevel::query()
|
||||
->whereIn('student_id', $studentIds)
|
||||
->where('school_year', $schoolYear)
|
||||
@@ -67,7 +67,7 @@ class GradingPlacementService
|
||||
}
|
||||
|
||||
$level = $level === '' || $level === null ? null : (int) $level;
|
||||
if ($level !== null && !in_array($level, [1, 2, 3], true)) {
|
||||
if ($level !== null && ! in_array($level, [1, 2, 3], true)) {
|
||||
throw new RuntimeException('Invalid placement level.');
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ class GradingPlacementService
|
||||
if ($existing) {
|
||||
$existing->delete();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -112,7 +113,7 @@ class GradingPlacementService
|
||||
|
||||
$validSet = array_flip($validIds);
|
||||
$existingRows = [];
|
||||
if (!empty($validIds)) {
|
||||
if (! empty($validIds)) {
|
||||
$rows = PlacementLevel::query()
|
||||
->whereIn('student_id', $validIds)
|
||||
->where('school_year', $schoolYear)
|
||||
@@ -124,12 +125,12 @@ class GradingPlacementService
|
||||
|
||||
foreach ($levels as $studentIdRaw => $levelRaw) {
|
||||
$studentId = (int) $studentIdRaw;
|
||||
if (!isset($validSet[$studentId])) {
|
||||
if (! isset($validSet[$studentId])) {
|
||||
continue;
|
||||
}
|
||||
$levelRaw = trim((string) $levelRaw);
|
||||
$level = $levelRaw === '' ? null : (int) $levelRaw;
|
||||
if ($level !== null && !in_array($level, [1, 2, 3], true)) {
|
||||
if ($level !== null && ! in_array($level, [1, 2, 3], true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -137,6 +138,7 @@ class GradingPlacementService
|
||||
if (isset($existingRows[$studentId])) {
|
||||
$existingRows[$studentId]->delete();
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -179,7 +181,7 @@ class GradingPlacementService
|
||||
$savedCount = 0;
|
||||
foreach ($levels as $studentIdRaw => $levelRaw) {
|
||||
$studentId = (int) $studentIdRaw;
|
||||
if (!isset($validSet[$studentId])) {
|
||||
if (! isset($validSet[$studentId])) {
|
||||
continue;
|
||||
}
|
||||
$levelRaw = trim((string) $levelRaw);
|
||||
@@ -212,7 +214,7 @@ class GradingPlacementService
|
||||
public function getPlacementBatch(int $batchId): array
|
||||
{
|
||||
$batch = PlacementBatch::query()->find($batchId);
|
||||
if (!$batch) {
|
||||
if (! $batch) {
|
||||
throw new RuntimeException('Placement batch not found.');
|
||||
}
|
||||
|
||||
@@ -230,7 +232,7 @@ class GradingPlacementService
|
||||
public function updatePlacementBatch(int $batchId, string $schoolYear, array $levels, ?int $userId): void
|
||||
{
|
||||
$batch = PlacementBatch::query()->find($batchId);
|
||||
if (!$batch) {
|
||||
if (! $batch) {
|
||||
throw new RuntimeException('Placement batch not found.');
|
||||
}
|
||||
|
||||
@@ -245,7 +247,7 @@ class GradingPlacementService
|
||||
|
||||
foreach ($levels as $studentIdRaw => $scoreRaw) {
|
||||
$studentId = (int) $studentIdRaw;
|
||||
if (!isset($validSet[$studentId])) {
|
||||
if (! isset($validSet[$studentId])) {
|
||||
continue;
|
||||
}
|
||||
$scoreRaw = trim((string) $scoreRaw);
|
||||
@@ -253,6 +255,7 @@ class GradingPlacementService
|
||||
if (isset($existing[$studentId])) {
|
||||
PlacementScore::query()->whereKey($existing[$studentId]['id'])->delete();
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
$score = (int) $scoreRaw;
|
||||
|
||||
Reference in New Issue
Block a user