From c6cdc1d9450c14cf2d4d5a60485c1832a4a6cf88 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Mon, 14 Oct 2013 09:51:38 +0200 Subject: [PATCH] Fixed counting occurences of numeric keys --- src/Controllers/TagController.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Controllers/TagController.php b/src/Controllers/TagController.php index 4940c76f..6c330d13 100644 --- a/src/Controllers/TagController.php +++ b/src/Controllers/TagController.php @@ -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;