UX: sort search logs results by unique searches

This commit is contained in:
Arpit Jalan 2017-11-15 12:58:40 +05:30
parent db68434db1
commit ee1f68438e
2 changed files with 3 additions and 1 deletions

View File

@ -1362,10 +1362,12 @@ table.api-keys {
.col.term { .col.term {
width: 30%; width: 30%;
text-align: left;
} }
.col.topic { .col.topic {
width: 35%; width: 35%;
text-align: left;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }

View File

@ -60,7 +60,7 @@ class SearchLog < ActiveRecord::Base
COUNT(DISTINCT ip_address) AS unique") COUNT(DISTINCT ip_address) AS unique")
.where('created_at > ?', start_of(period)) .where('created_at > ?', start_of(period))
.group(:term) .group(:term)
.order('COUNT(*) DESC') .order('COUNT(DISTINCT ip_address) DESC')
.limit(100).to_a .limit(100).to_a
end end