mirror of
https://github.com/immich-app/immich.git
synced 2025-01-21 00:52:43 -05:00
fix(server): show people without thumbnails (#14460)
* show people without thumbnails * redundant clause * updated sql
This commit is contained in:
parent
52247c3650
commit
ba9b9353bc
2 changed files with 4 additions and 11 deletions
|
@ -20,13 +20,12 @@ SELECT
|
||||||
"person"."isHidden" AS "person_isHidden"
|
"person"."isHidden" AS "person_isHidden"
|
||||||
FROM
|
FROM
|
||||||
"person" "person"
|
"person" "person"
|
||||||
LEFT JOIN "asset_faces" "face" ON "face"."personId" = "person"."id"
|
INNER JOIN "asset_faces" "face" ON "face"."personId" = "person"."id"
|
||||||
INNER JOIN "assets" "asset" ON "asset"."id" = "face"."assetId"
|
INNER JOIN "assets" "asset" ON "asset"."id" = "face"."assetId"
|
||||||
AND ("asset"."deletedAt" IS NULL)
|
AND ("asset"."deletedAt" IS NULL)
|
||||||
WHERE
|
WHERE
|
||||||
"person"."ownerId" = $1
|
"person"."ownerId" = $1
|
||||||
AND "asset"."isArchived" = false
|
AND "asset"."isArchived" = false
|
||||||
AND "person"."thumbnailPath" != ''
|
|
||||||
AND "person"."isHidden" = false
|
AND "person"."isHidden" = false
|
||||||
GROUP BY
|
GROUP BY
|
||||||
"person"."id"
|
"person"."id"
|
||||||
|
@ -257,15 +256,12 @@ SELECT
|
||||||
) AS "hidden"
|
) AS "hidden"
|
||||||
FROM
|
FROM
|
||||||
"person" "person"
|
"person" "person"
|
||||||
LEFT JOIN "asset_faces" "face" ON "face"."personId" = "person"."id"
|
INNER JOIN "asset_faces" "face" ON "face"."personId" = "person"."id"
|
||||||
INNER JOIN "assets" "asset" ON "asset"."id" = "face"."assetId"
|
INNER JOIN "assets" "asset" ON "asset"."id" = "face"."assetId"
|
||||||
AND ("asset"."deletedAt" IS NULL)
|
AND ("asset"."deletedAt" IS NULL)
|
||||||
WHERE
|
WHERE
|
||||||
"person"."ownerId" = $1
|
"person"."ownerId" = $1
|
||||||
AND "asset"."isArchived" = false
|
AND "asset"."isArchived" = false
|
||||||
AND "person"."thumbnailPath" != ''
|
|
||||||
HAVING
|
|
||||||
COUNT("face"."assetId") != 0
|
|
||||||
|
|
||||||
-- PersonRepository.getFacesByIds
|
-- PersonRepository.getFacesByIds
|
||||||
SELECT
|
SELECT
|
||||||
|
|
|
@ -86,7 +86,7 @@ export class PersonRepository implements IPersonRepository {
|
||||||
getAllForUser(pagination: PaginationOptions, userId: string, options?: PersonSearchOptions): Paginated<PersonEntity> {
|
getAllForUser(pagination: PaginationOptions, userId: string, options?: PersonSearchOptions): Paginated<PersonEntity> {
|
||||||
const queryBuilder = this.personRepository
|
const queryBuilder = this.personRepository
|
||||||
.createQueryBuilder('person')
|
.createQueryBuilder('person')
|
||||||
.leftJoin('person.faces', 'face')
|
.innerJoin('person.faces', 'face')
|
||||||
.where('person.ownerId = :userId', { userId })
|
.where('person.ownerId = :userId', { userId })
|
||||||
.innerJoin('face.asset', 'asset')
|
.innerJoin('face.asset', 'asset')
|
||||||
.andWhere('asset.isArchived = false')
|
.andWhere('asset.isArchived = false')
|
||||||
|
@ -95,7 +95,6 @@ export class PersonRepository implements IPersonRepository {
|
||||||
.addOrderBy('COUNT(face.assetId)', 'DESC')
|
.addOrderBy('COUNT(face.assetId)', 'DESC')
|
||||||
.addOrderBy("NULLIF(person.name, '')", 'ASC', 'NULLS LAST')
|
.addOrderBy("NULLIF(person.name, '')", 'ASC', 'NULLS LAST')
|
||||||
.addOrderBy('person.createdAt')
|
.addOrderBy('person.createdAt')
|
||||||
.andWhere("person.thumbnailPath != ''")
|
|
||||||
.having("person.name != '' OR COUNT(face.assetId) >= :faces", { faces: options?.minimumFaceCount || 1 })
|
.having("person.name != '' OR COUNT(face.assetId) >= :faces", { faces: options?.minimumFaceCount || 1 })
|
||||||
.groupBy('person.id');
|
.groupBy('person.id');
|
||||||
if (!options?.withHidden) {
|
if (!options?.withHidden) {
|
||||||
|
@ -232,14 +231,12 @@ export class PersonRepository implements IPersonRepository {
|
||||||
async getNumberOfPeople(userId: string): Promise<PeopleStatistics> {
|
async getNumberOfPeople(userId: string): Promise<PeopleStatistics> {
|
||||||
const items = await this.personRepository
|
const items = await this.personRepository
|
||||||
.createQueryBuilder('person')
|
.createQueryBuilder('person')
|
||||||
.leftJoin('person.faces', 'face')
|
.innerJoin('person.faces', 'face')
|
||||||
.where('person.ownerId = :userId', { userId })
|
.where('person.ownerId = :userId', { userId })
|
||||||
.innerJoin('face.asset', 'asset')
|
.innerJoin('face.asset', 'asset')
|
||||||
.andWhere('asset.isArchived = false')
|
.andWhere('asset.isArchived = false')
|
||||||
.andWhere("person.thumbnailPath != ''")
|
|
||||||
.select('COUNT(DISTINCT(person.id))', 'total')
|
.select('COUNT(DISTINCT(person.id))', 'total')
|
||||||
.addSelect('COUNT(DISTINCT(person.id)) FILTER (WHERE person.isHidden = true)', 'hidden')
|
.addSelect('COUNT(DISTINCT(person.id)) FILTER (WHERE person.isHidden = true)', 'hidden')
|
||||||
.having('COUNT(face.assetId) != 0')
|
|
||||||
.getRawOne();
|
.getRawOne();
|
||||||
|
|
||||||
if (items == undefined) {
|
if (items == undefined) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue