fix tests

This commit is contained in:
root
2026-06-11 11:46:12 -04:00
parent c91fa2ce4d
commit 5ead80fdc7
1489 changed files with 11349 additions and 10305 deletions
+9 -7
View File
@@ -2,11 +2,11 @@
namespace App\Services\Grading;
use App\Models\GradingLock;
use App\Models\ClassSection;
use RuntimeException;
use App\Models\GradingLock;
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,6 +32,7 @@ class GradingLockService
'locked_by' => null,
'locked_at' => null,
]);
return false;
}
@@ -97,7 +98,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;
}
@@ -107,6 +108,7 @@ class GradingLockService
'locked_at' => $now,
]);
$count++;
continue;
}
@@ -123,7 +125,7 @@ class GradingLockService
$count++;
}
if (!empty($insertRows)) {
if (! empty($insertRows)) {
GradingLock::query()->insert($insertRows);
}
@@ -138,7 +140,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).");
}