add test batches

This commit is contained in:
root
2026-06-08 23:45:55 -04:00
parent c792b8be05
commit 8d4d610b82
1480 changed files with 22587 additions and 10762 deletions
+7 -9
View File
@@ -2,11 +2,11 @@
namespace App\Services\Grading;
use App\Models\ClassSection;
use App\Models\GradingLock;
use App\Models\ClassSection;
use RuntimeException;
use App\Services\Grading\Policy\GradingPolicyResolver;
use App\Services\Grading\Validation\GradebookFinalizationValidator;
use RuntimeException;
class GradingLockService
{
@@ -14,8 +14,8 @@ class GradingLockService
private ?GradingPolicyResolver $policyResolver = null,
private ?GradebookFinalizationValidator $finalizationValidator = null
) {
$this->policyResolver = $this->policyResolver ?? new GradingPolicyResolver;
$this->finalizationValidator = $this->finalizationValidator ?? new GradebookFinalizationValidator;
$this->policyResolver = $this->policyResolver ?? new GradingPolicyResolver();
$this->finalizationValidator = $this->finalizationValidator ?? new GradebookFinalizationValidator();
}
public function toggle(int $classSectionId, string $semester, string $schoolYear, ?int $userId): bool
@@ -32,7 +32,6 @@ class GradingLockService
'locked_by' => null,
'locked_at' => null,
]);
return false;
}
@@ -98,7 +97,7 @@ class GradingLockService
foreach ($sectionIds as $sid) {
$this->assertCanLock($sid, $semester, $schoolYear);
if (! empty($existingBySection[$sid])) {
if (!empty($existingBySection[$sid])) {
if ($existingBySection[$sid]->is_locked) {
continue;
}
@@ -108,7 +107,6 @@ class GradingLockService
'locked_at' => $now,
]);
$count++;
continue;
}
@@ -125,7 +123,7 @@ class GradingLockService
$count++;
}
if (! empty($insertRows)) {
if (!empty($insertRows)) {
GradingLock::query()->insert($insertRows);
}
@@ -140,7 +138,7 @@ class GradingLockService
}
$result = $this->finalizationValidator->validateClassSectionBeforeLock($classSectionId, $semester, $schoolYear);
if (! $result['valid']) {
if (!$result['valid']) {
$count = count($result['errors']);
throw new RuntimeException("Cannot lock class section {$classSectionId}; strong grading validation failed with {$count} error(s).");
}