add tests batch 20
This commit is contained in:
@@ -6,11 +6,14 @@ use App\Models\Staff;
|
||||
use App\Models\TeacherClass;
|
||||
use App\Models\User;
|
||||
use App\Services\System\GlobalConfigService;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class StaffQueryService
|
||||
{
|
||||
public function __construct(private GlobalConfigService $configService) {}
|
||||
public function __construct(private GlobalConfigService $configService)
|
||||
{
|
||||
}
|
||||
|
||||
public function paginate(array $filters, int $page, int $perPage): array
|
||||
{
|
||||
@@ -19,7 +22,7 @@ class StaffQueryService
|
||||
$query = Staff::query()
|
||||
->whereNotIn(DB::raw('LOWER(active_role)'), $excluded);
|
||||
|
||||
if (! empty($filters['role'])) {
|
||||
if (!empty($filters['role'])) {
|
||||
$role = strtolower(trim((string) $filters['role']));
|
||||
$query->whereRaw('LOWER(active_role) = ?', [$role]);
|
||||
}
|
||||
@@ -44,7 +47,7 @@ class StaffQueryService
|
||||
if (in_array($role, ['teacher', 'teacher_assistant'], true)) {
|
||||
$tid = (int) ($staff->user_id ?? 0);
|
||||
$labels = $assignByTeacher[$tid] ?? [];
|
||||
if (! empty($labels)) {
|
||||
if (!empty($labels)) {
|
||||
$staff->class_section = implode(', ', array_unique($labels));
|
||||
$staff->verification_issue = false;
|
||||
} else {
|
||||
@@ -98,10 +101,10 @@ class StaffQueryService
|
||||
continue;
|
||||
}
|
||||
$pos = strtolower((string) ($row->position ?? ''));
|
||||
if (! in_array($pos, ['main', 'ta'], true)) {
|
||||
if (!in_array($pos, ['main', 'ta'], true)) {
|
||||
continue;
|
||||
}
|
||||
$assignByTeacher[$tid][] = $name.' ('.$pos.')';
|
||||
$assignByTeacher[$tid][] = $name . ' (' . $pos . ')';
|
||||
}
|
||||
|
||||
return $assignByTeacher;
|
||||
|
||||
Reference in New Issue
Block a user