Fix multiple entries in external share

pull/37/head
Varun Patil 2022-09-13 11:35:54 -07:00
parent 9c77a8f0c8
commit 77b1101bb3
2 changed files with 7 additions and 1 deletions

View File

@ -51,6 +51,11 @@ trait TimelineQueryDay {
// Add favorite field
$this->addFavoriteTag($query, $user);
// Get distinct fileids only
// This is required when browsing a folder in external storage
// since the same file can be present for multiple users
$query->groupBy('m.fileid');
// Group and sort by date taken
$query->orderBy('m.datetaken', 'DESC');
return $query;

View File

@ -29,7 +29,8 @@ trait TimelineQueryDays {
$whereFilecache
) {
// Get all entries also present in filecache
$query->select('m.dayid', $query->func()->count('m.fileid', 'count'))
$count = $query->func()->count($query->createFunction('DISTINCT m.fileid'), 'count');
$query->select('m.dayid', $count)
->from('memories', 'm')
->innerJoin('m', 'filecache', 'f',
$query->expr()->andX(