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
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:
@@ -13,6 +13,10 @@ class BadgeUserLookupService
|
||||
|
||||
public function fetchStaffList(?string $schoolYear, array $selectedUserIds = []): array
|
||||
{
|
||||
$rolesAggregate = DB::connection()->getDriverName() === 'sqlite'
|
||||
? "GROUP_CONCAT(DISTINCT CASE WHEN LOWER(roles.name) != 'parent' THEN roles.name END) as roles"
|
||||
: "GROUP_CONCAT(DISTINCT CASE WHEN LOWER(roles.name) != 'parent' THEN roles.name END ORDER BY roles.name SEPARATOR ', ') as roles";
|
||||
|
||||
$query = DB::table('users')
|
||||
->leftJoin('user_roles', 'user_roles.user_id', '=', 'users.id')
|
||||
->leftJoin('roles', 'roles.id', '=', 'user_roles.role_id')
|
||||
@@ -20,7 +24,7 @@ class BadgeUserLookupService
|
||||
'users.id',
|
||||
'users.firstname',
|
||||
'users.lastname',
|
||||
DB::raw("GROUP_CONCAT(DISTINCT CASE WHEN LOWER(roles.name) != 'parent' THEN roles.name END ORDER BY roles.name SEPARATOR ', ') as roles"),
|
||||
DB::raw($rolesAggregate),
|
||||
])
|
||||
->groupBy('users.id', 'users.firstname', 'users.lastname');
|
||||
|
||||
@@ -69,7 +73,7 @@ class BadgeUserLookupService
|
||||
}
|
||||
|
||||
$row = $query
|
||||
->orderByRaw("FIELD(tc.position, 'main', 'ta')")
|
||||
->orderByRaw("CASE tc.position WHEN 'main' THEN 0 WHEN 'ta' THEN 1 ELSE 2 END")
|
||||
->orderByRaw('IFNULL(tc.updated_at,"0000-00-00 00:00:00") DESC')
|
||||
->orderByDesc('tc.id')
|
||||
->first();
|
||||
|
||||
Reference in New Issue
Block a user