fix logic and tests, update docker CI file
This commit is contained in:
@@ -20,7 +20,14 @@ class AssignmentDataLoaderService
|
||||
->with([
|
||||
'teacher:id,firstname,lastname',
|
||||
])
|
||||
->when(filled($schoolYear), fn ($q) => $q->where('school_year', $schoolYear))
|
||||
->when(
|
||||
filled($schoolYear),
|
||||
fn ($q) => $q->where(function ($query) use ($schoolYear) {
|
||||
$query->where('school_year', $schoolYear)
|
||||
->orWhereNull('school_year')
|
||||
->orWhere('school_year', '');
|
||||
})
|
||||
)
|
||||
->get()
|
||||
->map(function ($row) {
|
||||
$row->teacher_full_name = trim(
|
||||
@@ -40,7 +47,14 @@ class AssignmentDataLoaderService
|
||||
'student:id,firstname,lastname,age,gender,registration_grade,photo_consent,tuition_paid,school_id,is_active',
|
||||
])
|
||||
->whereHas('student', fn ($q) => $q->where('is_active', 1))
|
||||
->when(filled($schoolYear), fn ($q) => $q->where('school_year', $schoolYear))
|
||||
->when(
|
||||
filled($schoolYear),
|
||||
fn ($q) => $q->where(function ($query) use ($schoolYear) {
|
||||
$query->where('school_year', $schoolYear)
|
||||
->orWhereNull('school_year')
|
||||
->orWhere('school_year', '');
|
||||
})
|
||||
)
|
||||
->get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,11 @@ class AssignmentSectionService
|
||||
|
||||
return $this->classSection
|
||||
->newQuery()
|
||||
->whereIn('id', $sectionIds)
|
||||
->whereIn('class_section_id', $sectionIds)
|
||||
->get()
|
||||
->mapWithKeys(function ($section) {
|
||||
$name = $section->class_section_name ?? $section->section_name ?? $section->name ?? '';
|
||||
return [(int) $section->id => (string) $name];
|
||||
return [(int) $section->class_section_id => (string) $name];
|
||||
})
|
||||
->all();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user