fix unit tests as well as missing code
API CI/CD / Validate (composer + pint) (push) Successful in 2m7s
API CI/CD / Test (PHPUnit) (push) Failing after 2m23s
API CI/CD / Build frontend assets (push) Successful in 2m18s
API CI/CD / Security audit (push) Successful in 31s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped

This commit is contained in:
root
2026-06-25 14:26:32 -04:00
parent fdfcd1f0e2
commit 940afe9319
115 changed files with 4554 additions and 290 deletions
@@ -12,27 +12,27 @@ class WhatsappContactService
public function listParentContacts(?string $schoolYear, ?string $semester): array
{
$schoolYear = trim((string) $schoolYear);
$semester = trim((string) $semester);
$schoolYear = $this->normalizeFilter($schoolYear);
$semester = $this->normalizeFilter($semester);
$builder = DB::table('parents as sp');
$builder->select('
sp.id AS parents_row_id,
sp.firstparent_id AS firstparent_id,
sp.secondparent_firstname AS sp_firstname,
sp.secondparent_lastname AS sp_lastname,
sp.secondparent_email AS sp_email,
sp.secondparent_phone AS sp_phone,
sp.school_year AS sp_school_year,
sp.semester AS sp_semester,
u.id AS u_id,
u.firstname AS u_firstname,
u.lastname AS u_lastname,
u.email AS u_email,
u.cellphone AS u_phone,
u.school_year AS u_school_year,
u.semester AS u_semester
');
$builder->select([
'sp.id AS parents_row_id',
'sp.firstparent_id AS firstparent_id',
'sp.secondparent_firstname AS sp_firstname',
'sp.secondparent_lastname AS sp_lastname',
'sp.secondparent_email AS sp_email',
'sp.secondparent_phone AS sp_phone',
'sp.school_year AS sp_school_year',
'sp.semester AS sp_semester',
'u.id AS u_id',
'u.firstname AS u_firstname',
'u.lastname AS u_lastname',
'u.email AS u_email',
'u.cellphone AS u_phone',
'u.school_year AS u_school_year',
'u.semester AS u_semester',
]);
$builder->leftJoin('users as u', 'u.id', '=', 'sp.firstparent_id');
if ($schoolYear !== '') {
@@ -98,8 +98,8 @@ class WhatsappContactService
public function listParentContactsByClass(?string $schoolYear, ?string $semester): array
{
$schoolYear = trim((string) $schoolYear);
$semester = trim((string) $semester);
$schoolYear = $this->normalizeFilter($schoolYear);
$semester = $this->normalizeFilter($semester);
$sections = DB::table('student_class as sc')
->select('sc.class_section_id', DB::raw('MAX(sc.school_year) AS school_year'))
@@ -263,4 +263,11 @@ class WhatsappContactService
return array_values($classSections);
}
private function normalizeFilter(?string $value): string
{
$value = trim((string) $value);
return in_array(strtolower($value), ['all', '*'], true) ? '' : $value;
}
}