mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-24 09:50:17 -06:00
Fixed visits count multiplied by the number of tags when ordering and filtering by text
This commit is contained in:
parent
f4b569c245
commit
a79c1f580e
@ -51,7 +51,7 @@ class ShortUrlRepository extends EntityRepository implements ShortUrlRepositoryI
|
||||
$order = \is_array($orderBy) ? $orderBy[$fieldName] : 'ASC';
|
||||
|
||||
if (\in_array($fieldName, ['visits', 'visitsCount', 'visitCount'], true)) {
|
||||
$qb->addSelect('COUNT(v) AS totalVisits')
|
||||
$qb->addSelect('COUNT(DISTINCT v) AS totalVisits')
|
||||
->leftJoin('s.visits', 'v')
|
||||
->groupBy('s')
|
||||
->orderBy('totalVisits', $order);
|
||||
|
Loading…
Reference in New Issue
Block a user