4 Commits

Author SHA1 Message Date
7d82a4a924 Merge pull request 'Complete date-ordered orderings' (#29) from electricdusk/pics:assets-complete-ordering into master
Reviewed-on: Public/pics#29
2022-11-22 21:09:10 +01:00
b7a37c85f6 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.
2022-11-22 12:00:53 +01:00
0ec0de4414 Replace deprecated strftime calls 2022-05-07 13:25:19 +02:00
69417c36ed Merge pull request 'EXIF: prefer DateTimeOriginal over DateTimeDigitized' (#27) from exif-date-time-original into master
Reviewed-on: Public/pics#27
2022-02-16 21:56:04 +01:00
3 changed files with 12 additions and 16 deletions

View File

@@ -89,7 +89,7 @@ class ManageErrors extends HTMLController
'header' => 'UID', 'header' => 'UID',
'is_sortable' => true, 'is_sortable' => true,
'parse' => [ 'parse' => [
'link' => BASEURL . '/member/?id={ID_USER}', 'link' => BASEURL . '/edituser/?id={ID_USER}',
'data' => 'id_user', 'data' => 'id_user',
], ],
], ],

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',
[ [

View File

@@ -228,9 +228,9 @@ class GenericTable
// Timestamps get custom treatment. // Timestamps get custom treatment.
case 'timestamp': case 'timestamp':
if (empty($options['data']['pattern']) || $options['data']['pattern'] === 'long') if (empty($options['data']['pattern']) || $options['data']['pattern'] === 'long')
$pattern = '%F %H:%M'; $pattern = 'Y-m-d H:i';
elseif ($options['data']['pattern'] === 'short') elseif ($options['data']['pattern'] === 'short')
$pattern = '%F'; $pattern = 'Y-m-d';
else else
$pattern = $options['data']['pattern']; $pattern = $options['data']['pattern'];
@@ -242,7 +242,7 @@ class GenericTable
if (isset($options['data']['if_null']) && $timestamp == 0) if (isset($options['data']['if_null']) && $timestamp == 0)
$value = $options['data']['if_null']; $value = $options['data']['if_null'];
else else
$value = strftime($pattern, $timestamp); $value = date($pattern, $timestamp);
break; break;
} }