mirror of
https://github.com/immich-app/immich.git
synced 2025-05-31 12:15:47 -04:00
fix(server): Fix for sorting faces during merging (#15571)
* Fix for sorting faces * Put uneccessary orderBy in if statement
This commit is contained in:
parent
a07ae9b5b2
commit
065d885ca0
@ -133,10 +133,6 @@ export class PersonRepository implements IPersonRepository {
|
|||||||
)
|
)
|
||||||
.where('person.ownerId', '=', userId)
|
.where('person.ownerId', '=', userId)
|
||||||
.orderBy('person.isHidden', 'asc')
|
.orderBy('person.isHidden', 'asc')
|
||||||
.orderBy(sql`NULLIF(person.name, '') is null`, 'asc')
|
|
||||||
.orderBy((eb) => eb.fn.count('asset_faces.assetId'), 'desc')
|
|
||||||
.orderBy(sql`NULLIF(person.name, '')`, sql`asc nulls last`)
|
|
||||||
.orderBy('person.createdAt')
|
|
||||||
.having((eb) =>
|
.having((eb) =>
|
||||||
eb.or([
|
eb.or([
|
||||||
eb('person.name', '!=', ''),
|
eb('person.name', '!=', ''),
|
||||||
@ -161,6 +157,13 @@ export class PersonRepository implements IPersonRepository {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
.$if(!options?.closestFaceAssetId, (qb) =>
|
||||||
|
qb
|
||||||
|
.orderBy(sql`NULLIF(person.name, '') is null`, 'asc')
|
||||||
|
.orderBy((eb) => eb.fn.count('asset_faces.assetId'), 'desc')
|
||||||
|
.orderBy(sql`NULLIF(person.name, '')`, sql`asc nulls last`)
|
||||||
|
.orderBy('person.createdAt'),
|
||||||
|
)
|
||||||
.$if(!options?.withHidden, (qb) => qb.where('person.isHidden', '=', false))
|
.$if(!options?.withHidden, (qb) => qb.where('person.isHidden', '=', false))
|
||||||
.offset(pagination.skip ?? 0)
|
.offset(pagination.skip ?? 0)
|
||||||
.limit(pagination.take + 1)
|
.limit(pagination.take + 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user