add tests batch 20
This commit is contained in:
@@ -7,11 +7,10 @@ use App\Models\ClassProgressReport;
|
||||
use App\Models\TeacherClass;
|
||||
use App\Models\User;
|
||||
use App\Services\SchoolYears\SchoolYearContextService;
|
||||
use Carbon\CarbonInterface;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ClassProgressMutationService
|
||||
{
|
||||
@@ -35,11 +34,11 @@ class ClassProgressMutationService
|
||||
$weekStart = (string) ($payload['week_start'] ?? '');
|
||||
$weekEnd = $this->rules->ensureWeekEnd($weekStart, $payload['week_end'] ?? null);
|
||||
|
||||
if (! $this->rules->isWeekEndValid($weekStart, $weekEnd)) {
|
||||
if (!$this->rules->isWeekEndValid($weekStart, $weekEnd)) {
|
||||
throw new \InvalidArgumentException('Week end must be the same as or after the week start.');
|
||||
}
|
||||
|
||||
if (! $this->rules->hasIslamicUnitSelection($payload)) {
|
||||
if (!$this->rules->hasIslamicUnitSelection($payload)) {
|
||||
throw new \InvalidArgumentException('Please select at least one Islamic Studies unit.');
|
||||
}
|
||||
|
||||
@@ -54,7 +53,7 @@ class ClassProgressMutationService
|
||||
->values()
|
||||
->all();
|
||||
|
||||
if ($existingIds !== [] && ! $confirmOverwrite) {
|
||||
if ($existingIds !== [] && !$confirmOverwrite) {
|
||||
throw new \InvalidArgumentException('CONFIRM_OVERWRITE');
|
||||
}
|
||||
|
||||
@@ -151,7 +150,7 @@ class ClassProgressMutationService
|
||||
throw new \InvalidArgumentException('Please select at least one Islamic Studies unit.');
|
||||
}
|
||||
|
||||
$originalWeekStart = $anchor->week_start instanceof CarbonInterface
|
||||
$originalWeekStart = $anchor->week_start instanceof \Carbon\CarbonInterface
|
||||
? $anchor->week_start->format('Y-m-d')
|
||||
: (string) $anchor->week_start;
|
||||
|
||||
@@ -296,7 +295,7 @@ class ClassProgressMutationService
|
||||
return DB::transaction(function () use ($report, $payload, $attachments) {
|
||||
$weekStart = $payload['week_start'] ?? $report->week_start?->format('Y-m-d');
|
||||
$weekEnd = $this->rules->ensureWeekEnd((string) $weekStart, $payload['week_end'] ?? null);
|
||||
if ($weekStart && $weekEnd && ! $this->rules->isWeekEndValid((string) $weekStart, (string) $weekEnd)) {
|
||||
if ($weekStart && $weekEnd && !$this->rules->isWeekEndValid((string) $weekStart, (string) $weekEnd)) {
|
||||
throw new \InvalidArgumentException('Week end must be the same as or after the week start.');
|
||||
}
|
||||
|
||||
@@ -365,7 +364,7 @@ class ClassProgressMutationService
|
||||
->where('class_section_id', $classSectionId)
|
||||
->exists();
|
||||
|
||||
if (! $assigned) {
|
||||
if (!$assigned) {
|
||||
throw new \InvalidArgumentException('No class assignment found for this report.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user