1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-16 07:24:40 +02:00

fix: people ordering by asset count (#19366)

This commit is contained in:
Zack Pollard
2025-06-20 13:34:04 +01:00
committed by GitHub
parent a5ed453929
commit 00aa385972
3 changed files with 17 additions and 15 deletions

View File

@ -35,8 +35,9 @@ having
order by
"person"."isHidden" asc,
"person"."isFavorite" desc,
NULLIF(person.name, '') asc nulls last,
NULLIF(person.name, '') is null asc,
count("asset_faces"."assetId") desc,
NULLIF(person.name, '') asc nulls last,
"person"."createdAt"
limit
$5

View File

@ -180,8 +180,9 @@ export class PersonRepository {
)
.$if(!options?.closestFaceAssetId, (qb) =>
qb
.orderBy(sql`NULLIF(person.name, '')`, (om) => om.asc().nullsLast())
.orderBy(sql`NULLIF(person.name, '') is null`, 'asc')
.orderBy((eb) => eb.fn.count('asset_faces.assetId'), 'desc')
.orderBy(sql`NULLIF(person.name, '')`, (om) => om.asc().nullsLast())
.orderBy('person.createdAt'),
)
.$if(!options?.withHidden, (qb) => qb.where('person.isHidden', '=', false))