mirror of
https://github.com/immich-app/immich.git
synced 2026-02-09 11:20:00 +03:00
fix(server): people count doesn't match array
This commit is contained in:
@@ -358,7 +358,7 @@ export class PersonRepository {
|
||||
}
|
||||
|
||||
@GenerateSql({ params: [DummyValue.UUID] })
|
||||
getNumberOfPeople(userId: string) {
|
||||
getNumberOfPeople(userId: string, options?: PersonSearchOptions) {
|
||||
const zero = sql.lit(0);
|
||||
return this.db
|
||||
.selectFrom('person')
|
||||
@@ -368,6 +368,12 @@ export class PersonRepository {
|
||||
.selectFrom('asset_face')
|
||||
.whereRef('asset_face.personId', '=', 'person.id')
|
||||
.where('asset_face.deletedAt', 'is', null)
|
||||
.having((eb) =>
|
||||
eb.or([
|
||||
eb('person.name', '!=', ''),
|
||||
eb((innerEb) => innerEb.fn.count('asset_face.assetId'), '>=', options?.minimumFaceCount || 1),
|
||||
]),
|
||||
)
|
||||
.where((eb) =>
|
||||
eb.exists((eb) =>
|
||||
eb
|
||||
|
||||
@@ -67,7 +67,10 @@ export class PersonService extends BaseService {
|
||||
withHidden,
|
||||
closestFaceAssetId,
|
||||
});
|
||||
const { total, hidden } = await this.personRepository.getNumberOfPeople(auth.user.id);
|
||||
const { total, hidden } = await this.personRepository.getNumberOfPeople(auth.user.id, {
|
||||
minimumFaceCount: machineLearning.facialRecognition.minFaces,
|
||||
withHidden,
|
||||
});
|
||||
|
||||
return {
|
||||
people: items.map((person) => mapPerson(person)),
|
||||
|
||||
Reference in New Issue
Block a user