Complete date-ordered orderings

Bug as reported by Yorick: When two Assets have the same capture
date, a bug occurs in the interface where the user gets stuck in
a loop when moving to the next image.

This patch uses the primary key as a fallback when ordering the
images by capture date.  This way, the asset ordering is complete
and it should resolve the bug.
This commit is contained in:
Amber Sprenkels 2022-11-22 11:41:54 +01:00
parent 0ec0de4414
commit b7a37c85f6
1 changed files with 8 additions and 12 deletions

View File

@ -606,14 +606,12 @@ class Asset
FROM assets_tags AS t FROM assets_tags AS t
INNER JOIN assets AS a ON a.id_asset = t.id_asset INNER JOIN assets AS a ON a.id_asset = t.id_asset
WHERE t.id_tag = {int:id_tag} AND WHERE t.id_tag = {int:id_tag} AND
a.date_captured <= {datetime:date_captured} AND (a.date_captured, a.id_asset) < ({datetime:date_captured}, {int:id_asset})
a.id_asset != {int:id_asset} ORDER BY a.date_captured DESC, a.id_asset DESC'
ORDER BY a.date_captured DESC'
: ' : '
FROM assets AS a FROM assets AS a
WHERE date_captured >= {datetime:date_captured} AND WHERE (a.date_captured, a.id_asset) > ({datetime:date_captured}, {int:id_asset})
a.id_asset != {int:id_asset} ORDER BY date_captured ASC, a.id_asset ASC')
ORDER BY date_captured ASC')
. ' . '
LIMIT 1', LIMIT 1',
[ [
@ -639,14 +637,12 @@ class Asset
FROM assets_tags AS t FROM assets_tags AS t
INNER JOIN assets AS a ON a.id_asset = t.id_asset INNER JOIN assets AS a ON a.id_asset = t.id_asset
WHERE t.id_tag = {int:id_tag} AND WHERE t.id_tag = {int:id_tag} AND
a.date_captured >= {datetime:date_captured} AND (a.date_captured, a.id_asset) > ({datetime:date_captured}, {int:id_asset})
a.id_asset != {int:id_asset} ORDER BY a.date_captured ASC, a.id_asset ASC'
ORDER BY a.date_captured ASC'
: ' : '
FROM assets AS a FROM assets AS a
WHERE date_captured <= {datetime:date_captured} AND WHERE (a.date_captured, a.id_asset) < ({datetime:date_captured}, {int:id_asset})
a.id_asset != {int:id_asset} ORDER BY date_captured DESC, a.id_asset DESC')
ORDER BY date_captured DESC')
. ' . '
LIMIT 1', LIMIT 1',
[ [