fix gitlab tests
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,7 +80,6 @@ class GradingPlacementService
|
||||
if ($existing) {
|
||||
$existing->delete();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -113,7 +112,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)
|
||||
@@ -125,12 +124,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;
|
||||
}
|
||||
|
||||
@@ -138,7 +137,6 @@ class GradingPlacementService
|
||||
if (isset($existingRows[$studentId])) {
|
||||
$existingRows[$studentId]->delete();
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -181,7 +179,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);
|
||||
@@ -214,7 +212,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.');
|
||||
}
|
||||
|
||||
@@ -232,7 +230,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.');
|
||||
}
|
||||
|
||||
@@ -247,7 +245,7 @@ class GradingPlacementService
|
||||
|
||||
foreach ($levels as $studentIdRaw => $scoreRaw) {
|
||||
$studentId = (int) $studentIdRaw;
|
||||
if (! isset($validSet[$studentId])) {
|
||||
if (!isset($validSet[$studentId])) {
|
||||
continue;
|
||||
}
|
||||
$scoreRaw = trim((string) $scoreRaw);
|
||||
@@ -255,7 +253,6 @@ class GradingPlacementService
|
||||
if (isset($existing[$studentId])) {
|
||||
PlacementScore::query()->whereKey($existing[$studentId]['id'])->delete();
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
$score = (int) $scoreRaw;
|
||||
|
||||
Reference in New Issue
Block a user