mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-01-02 03:37:54 +02:00
Merge pull request #913 from grasdk/bugfix/892
added coalesce to search queries in case offset is null
This commit is contained in:
commit
9810ea036a
@ -365,7 +365,7 @@ export class SearchManager {
|
|||||||
switch (sort.method) {
|
switch (sort.method) {
|
||||||
case SortByTypes.Date:
|
case SortByTypes.Date:
|
||||||
if (Config.Gallery.ignoreTimestampOffset === true) {
|
if (Config.Gallery.ignoreTimestampOffset === true) {
|
||||||
query.addOrderBy('media.metadata.creationDate + (media.metadata.creationDateOffset * 60000)', sort.ascending ? 'ASC' : 'DESC');
|
query.addOrderBy('media.metadata.creationDate + (coalesce(media.metadata.creationDateOffset,0) * 60000)', sort.ascending ? 'ASC' : 'DESC');
|
||||||
} else {
|
} else {
|
||||||
query.addOrderBy('media.metadata.creationDate', sort.ascending ? 'ASC' : 'DESC');
|
query.addOrderBy('media.metadata.creationDate', sort.ascending ? 'ASC' : 'DESC');
|
||||||
}
|
}
|
||||||
@ -568,7 +568,7 @@ export class SearchManager {
|
|||||||
textParam['from' + queryId] = (query as FromDateSearch).value;
|
textParam['from' + queryId] = (query as FromDateSearch).value;
|
||||||
if (Config.Gallery.ignoreTimestampOffset === true) {
|
if (Config.Gallery.ignoreTimestampOffset === true) {
|
||||||
q.where(
|
q.where(
|
||||||
`(media.metadata.creationDate + (media.metadata.creationDateOffset * 60000)) ${relation} :from${queryId}`,
|
`(media.metadata.creationDate + (coalesce(media.metadata.creationDateOffset,0) * 60000)) ${relation} :from${queryId}`,
|
||||||
textParam
|
textParam
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -597,7 +597,7 @@ export class SearchManager {
|
|||||||
textParam['to' + queryId] = (query as ToDateSearch).value;
|
textParam['to' + queryId] = (query as ToDateSearch).value;
|
||||||
if (Config.Gallery.ignoreTimestampOffset === true) {
|
if (Config.Gallery.ignoreTimestampOffset === true) {
|
||||||
q.where(
|
q.where(
|
||||||
`(media.metadata.creationDate + (media.metadata.creationDateOffset * 60000)) ${relation} :to${queryId}`,
|
`(media.metadata.creationDate + (coalesce(media.metadata.creationDateOffset,0) * 60000)) ${relation} :to${queryId}`,
|
||||||
textParam
|
textParam
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -809,9 +809,9 @@ export class SearchManager {
|
|||||||
if (tq.negate) {
|
if (tq.negate) {
|
||||||
if (Config.Gallery.ignoreTimestampOffset === true) {
|
if (Config.Gallery.ignoreTimestampOffset === true) {
|
||||||
q.where(
|
q.where(
|
||||||
`(media.metadata.creationDate + (media.metadata.creationDateOffset * 60000)) >= :to${queryId}`,
|
`(media.metadata.creationDate + (coalesce(media.metadata.creationDateOffset,0) * 60000)) >= :to${queryId}`,
|
||||||
textParam
|
textParam
|
||||||
).orWhere(`(media.metadata.creationDate + (media.metadata.creationDateOffset * 60000)) < :from${queryId}`,
|
).orWhere(`(media.metadata.creationDate + (coalesce(media.metadata.creationDateOffset,0) * 60000)) < :from${queryId}`,
|
||||||
textParam);
|
textParam);
|
||||||
} else {
|
} else {
|
||||||
q.where(
|
q.where(
|
||||||
@ -824,9 +824,9 @@ export class SearchManager {
|
|||||||
} else {
|
} else {
|
||||||
if (Config.Gallery.ignoreTimestampOffset === true) {
|
if (Config.Gallery.ignoreTimestampOffset === true) {
|
||||||
q.where(
|
q.where(
|
||||||
`(media.metadata.creationDate + (media.metadata.creationDateOffset * 60000)) < :to${queryId}`,
|
`(media.metadata.creationDate + (coalesce(media.metadata.creationDateOffset,0) * 60000)) < :to${queryId}`,
|
||||||
textParam
|
textParam
|
||||||
).andWhere(`(media.metadata.creationDate + (media.metadata.creationDateOffset * 60000)) >= :from${queryId}`,
|
).andWhere(`(media.metadata.creationDate + (coalesce(media.metadata.creationDateOffset,0) * 60000)) >= :from${queryId}`,
|
||||||
textParam);
|
textParam);
|
||||||
} else {
|
} else {
|
||||||
q.where(
|
q.where(
|
||||||
|
@ -1084,7 +1084,7 @@ export class ClientGalleryConfig {
|
|||||||
|
|
||||||
@ConfigProperty({
|
@ConfigProperty({
|
||||||
tags: {
|
tags: {
|
||||||
name: $localize`Ignore timestamp offsets`,
|
name: $localize`Ignore timestamp offsets (use local time)`,
|
||||||
priority: ConfigPriority.advanced,
|
priority: ConfigPriority.advanced,
|
||||||
},
|
},
|
||||||
description: $localize`If enabled, timestamp offsets are ignored, meaning that the local times of pictures are used for searching, sorting and grouping. If disabled, global time is used and pictures with no timestamp are assumed to be in UTC (offset +00:00).`
|
description: $localize`If enabled, timestamp offsets are ignored, meaning that the local times of pictures are used for searching, sorting and grouping. If disabled, global time is used and pictures with no timestamp are assumed to be in UTC (offset +00:00).`
|
||||||
|
Loading…
Reference in New Issue
Block a user