mirror of
https://github.com/shlinkio/shlink.git
synced 2025-03-14 04:00:57 +03: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
1 changed files with 1 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue