Fixed counting occurences of numeric keys
This commit is contained in:
parent
23fc89c30c
commit
c6cdc1d945
1 changed files with 3 additions and 6 deletions
|
@ -16,19 +16,16 @@ class TagController
|
|||
$dbQuery->innerJoin('post_tag');
|
||||
$dbQuery->on('tag.id = post_tag.tag_id');
|
||||
$dbQuery->groupBy('tag.id');
|
||||
$dbQuery->orderBy('count desc, LOWER(tag.name) asc');
|
||||
$rows = $dbQuery->get();
|
||||
|
||||
$tags = [];
|
||||
$tagDistribution = [];
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$tags []= $row['name'];
|
||||
$tagDistribution[$row['name']] = $row['count'];
|
||||
$tags []= strval($row['name']);
|
||||
$tagDistribution[$row['name']] = intval($row['count']);
|
||||
}
|
||||
array_multisort(
|
||||
array_values($tagDistribution), SORT_DESC, SORT_NUMERIC,
|
||||
array_keys($tagDistribution), SORT_ASC, SORT_NATURAL | SORT_FLAG_CASE,
|
||||
$tagDistribution);
|
||||
|
||||
$this->context->transport->tags = $tags;
|
||||
$this->context->transport->tagDistribution = $tagDistribution;
|
||||
|
|
Loading…
Reference in a new issue