fix tests
This commit is contained in:
@@ -8,8 +8,8 @@ use App\Models\Configuration;
|
||||
use App\Models\TeacherClass;
|
||||
use App\Models\User;
|
||||
use App\Services\SchoolYears\SchoolYearContextService;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ClassProgressQueryService
|
||||
{
|
||||
@@ -28,7 +28,7 @@ class ClassProgressQueryService
|
||||
->with(['classSection', 'teacher'])
|
||||
->orderBy($filters['sort_by'] ?? 'week_start', $filters['sort_dir'] ?? 'desc');
|
||||
|
||||
if (!$this->isAdmin($user)) {
|
||||
if (! $this->isAdmin($user)) {
|
||||
$relaxedSectionIds = TeacherClass::distinctSectionIdsForTeacher((int) $user->id);
|
||||
|
||||
if (! empty($filters['class_section_id'])) {
|
||||
@@ -50,31 +50,31 @@ class ClassProgressQueryService
|
||||
$query->where('teacher_id', (int) $filters['teacher_id']);
|
||||
}
|
||||
|
||||
if (!empty($filters['class_section_id'])) {
|
||||
if (! empty($filters['class_section_id'])) {
|
||||
$query->where('class_section_id', (int) $filters['class_section_id']);
|
||||
}
|
||||
|
||||
if (!empty($filters['subject'])) {
|
||||
if (! empty($filters['subject'])) {
|
||||
$query->where('subject', (string) $filters['subject']);
|
||||
}
|
||||
|
||||
if (!empty($filters['status'])) {
|
||||
if (! empty($filters['status'])) {
|
||||
$query->where('status', (string) $filters['status']);
|
||||
}
|
||||
|
||||
if (!empty($filters['school_year']) && Schema::hasColumn('class_progress_reports', 'school_year')) {
|
||||
if (! empty($filters['school_year']) && Schema::hasColumn('class_progress_reports', 'school_year')) {
|
||||
$query->where('school_year', (string) $filters['school_year']);
|
||||
}
|
||||
|
||||
if (!empty($filters['semester']) && Schema::hasColumn('class_progress_reports', 'semester')) {
|
||||
if (! empty($filters['semester']) && Schema::hasColumn('class_progress_reports', 'semester')) {
|
||||
$query->where('semester', (string) $filters['semester']);
|
||||
}
|
||||
|
||||
if (!empty($filters['week_start'])) {
|
||||
if (! empty($filters['week_start'])) {
|
||||
$query->whereDate('week_start', '>=', $filters['week_start']);
|
||||
}
|
||||
|
||||
if (!empty($filters['week_end'])) {
|
||||
if (! empty($filters['week_end'])) {
|
||||
$query->whereDate('week_end', '<=', $filters['week_end']);
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@ class ClassProgressQueryService
|
||||
return $rows->map(function (ClassProgressReport $row) use ($attachments) {
|
||||
$row->setAttribute('status_label', $this->statusLabel($row->status));
|
||||
$row->setAttribute('attachments', $attachments[$row->id] ?? []);
|
||||
|
||||
return $row;
|
||||
})->all();
|
||||
}
|
||||
@@ -159,6 +160,7 @@ class ClassProgressQueryService
|
||||
private function statusLabel(?string $status): string
|
||||
{
|
||||
$options = (array) config('progress.status_options', []);
|
||||
|
||||
return $options[$status] ?? 'Unknown';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user