add test batches

This commit is contained in:
root
2026-06-08 23:45:55 -04:00
parent c792b8be05
commit 8d4d610b82
1480 changed files with 22587 additions and 10762 deletions
+13 -10
View File
@@ -5,11 +5,14 @@ namespace App\Services\Families;
use App\Models\Family;
use App\Models\Student;
use App\Models\StudentClass;
use App\Models\User;
use Illuminate\Support\Facades\DB;
class FamilyQueryService
{
public function __construct(private FamilyFinanceService $finance) {}
public function __construct(private FamilyFinanceService $finance)
{
}
public function listStudentsForSelect(): array
{
@@ -29,7 +32,7 @@ class FamilyQueryService
return [];
}
$qs = '%'.str_replace(['%', '_'], ['\\%', '\\_'], $query).'%';
$qs = '%' . str_replace(['%', '_'], ['\\%', '\\_'], $query) . '%';
$students = DB::table('students')
->select('id', 'firstname', 'lastname')
@@ -60,7 +63,7 @@ class FamilyQueryService
$items[] = [
'type' => 'student',
'id' => (int) ($s['id'] ?? 0),
'label' => trim(($s['firstname'] ?? '').' '.($s['lastname'] ?? '')),
'label' => trim(($s['firstname'] ?? '') . ' ' . ($s['lastname'] ?? '')),
'sub' => 'Student',
];
}
@@ -68,8 +71,8 @@ class FamilyQueryService
$items[] = [
'type' => 'guardian',
'id' => (int) ($g['id'] ?? 0),
'label' => trim(($g['firstname'] ?? '').' '.($g['lastname'] ?? '')),
'sub' => trim(($g['email'] ?? '').' '.($g['cellphone'] ?? '')),
'label' => trim(($g['firstname'] ?? '') . ' ' . ($g['lastname'] ?? '')),
'sub' => trim(($g['email'] ?? '') . ' ' . ($g['cellphone'] ?? '')),
];
}
@@ -90,7 +93,7 @@ class FamilyQueryService
->orderBy('s.firstname')
->select('s.id as student_id')
->first();
if ($row && ! empty($row->student_id)) {
if ($row && !empty($row->student_id)) {
return (int) $row->student_id;
}
@@ -233,7 +236,7 @@ class FamilyQueryService
unset($fam);
$data['families'] = $families;
if (! empty($families)) {
if (!empty($families)) {
$familyId = (int) ($families[0]['id'] ?? 0);
$data['guardians'] = $familyId ? $this->listGuardiansByFamily($familyId) : [];
}
@@ -303,7 +306,7 @@ class FamilyQueryService
)
->find($familyId);
if (! $family) {
if (!$family) {
return null;
}
@@ -361,7 +364,7 @@ class FamilyQueryService
foreach ($guardians as $g) {
$gid = (int) ($g['user_id'] ?? 0);
if ($gid > 0) {
$guardianMap[$gid] = trim(($g['firstname'] ?? '').' '.($g['lastname'] ?? ''));
$guardianMap[$gid] = trim(($g['firstname'] ?? '') . ' ' . ($g['lastname'] ?? ''));
}
}
@@ -375,7 +378,7 @@ class FamilyQueryService
foreach ($rows as &$row) {
$pid = (int) ($row['parent_id'] ?? 0);
$row['parent_label'] = $guardianMap[$pid] ?? ('Parent #'.$pid);
$row['parent_label'] = $guardianMap[$pid] ?? ('Parent #' . $pid);
}
unset($row);