1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-12-01 22:52:06 +02:00

Fixing projected Persons UI bugs #1015

This commit is contained in:
Patrik J. Braun
2025-09-09 22:41:36 +02:00
parent 8337eeafa4
commit b03f6bf5db
5 changed files with 15 additions and 5 deletions

View File

@@ -75,6 +75,9 @@ export class PersonManager implements IObjectManager {
// Apply projection query if it exists
if (session.projectionQuery) {
if (session.hasDirectoryProjection) {
baseQb.leftJoin('media.directory', 'directory');
}
baseQb.andWhere(session.projectionQuery);
}
@@ -96,6 +99,9 @@ export class PersonManager implements IObjectManager {
// Apply projection query if it exists
if (session.projectionQuery) {
if (session.hasDirectoryProjection) {
sampleQb.leftJoin('media.directory', 'directory');
}
sampleQb.andWhere(session.projectionQuery);
}
@@ -309,7 +315,7 @@ export class PersonManager implements IObjectManager {
this.personsCache = this.personsCache || {};
const persons = await personRepository
.createQueryBuilder('person')
.leftJoin('person.cache', 'cache', 'cache.projectionKey = :pk AND cache.valid = 1', {pk: session.user.projectionKey})
.leftJoin('person.cache', 'cache', 'cache.projectionKey = :pk', {pk: session.user.projectionKey})
.leftJoin('cache.sampleRegion', 'sampleRegion')
.leftJoin('sampleRegion.media', 'media')
.leftJoin('media.directory', 'directory')
@@ -319,10 +325,11 @@ export class PersonManager implements IObjectManager {
'person.isFavourite',
'cache.count',
'sampleRegion',
'media.name',
'media',
'directory.path',
'directory.name'
])
.where('cache.valid = 1 AND cache.count > 0')
.getMany();
// Fix cache property: convert from array to single object

View File

@@ -128,10 +128,11 @@ export class SearchManager {
await personRepository
.createQueryBuilder('person')
.select('DISTINCT(person.name), cache.count')
.leftJoin('person.cache', 'cache', 'cache.projectionKey = :pk AND cache.valid = 1', {pk: session.user.projectionKey})
.leftJoin('person.cache', 'cache', 'cache.projectionKey = :pk', {pk: session.user.projectionKey})
.where('person.name LIKE :text COLLATE ' + SQL_COLLATE, {
text: '%' + text + '%',
})
.andWhere('cache.count > 0 AND cache.valid = 1')
.limit(
Config.Search.AutoComplete.ItemsPerCategory.person
)

View File

@@ -1,4 +1,5 @@
export interface PersonDTO {
cache: PersonCacheDTO;
id: number;
name: string;
missingThumbnail?: boolean;

View File

@@ -1,4 +1,4 @@
import {PersonDTO} from '../../../../common/entities/PersonDTO';
import {PersonCacheDTO, PersonDTO} from '../../../../common/entities/PersonDTO';
import {Config} from '../../../../common/config/public/Config';
import {Utils} from '../../../../common/Utils';
@@ -7,6 +7,7 @@ export class Person implements PersonDTO {
count: number;
id: number;
name: string;
cache:PersonCacheDTO;
public static getThumbnailUrl(that: PersonDTO): string {

View File

@@ -23,7 +23,7 @@
[class.clickable]="CanUpdate"
(click)="CanUpdate && toggleFavourite($event)"
></ng-icon>
{{person.name}} ({{person.count}})
{{person.name}} ({{person.cache.count}})
</div>
</a>