DEV: Remove the unique_searches column from select query

DEV: Remove the unique_searches column from select query
diff --git a/app/models/search_log.rb b/app/models/search_log.rb
index 738760f..d046dae 100644
--- a/app/models/search_log.rb
+++ b/app/models/search_log.rb
@@ -125,8 +125,7 @@ class SearchLog < ActiveRecord::Base
       SUM(CASE
                WHEN search_result_id IS NOT NULL THEN 1
                ELSE 0
-           END) AS click_through,
-      COUNT(DISTINCT ip_address) AS unique_searches
+           END) AS click_through
     SQL
 
     result = SearchLog.select(select_sql)
@@ -141,7 +140,7 @@ class SearchLog < ActiveRecord::Base
     end
 
     result.group('lower(term)')
-      .order('searches DESC, click_through DESC, unique_searches DESC, term ASC')
+      .order('searches DESC, click_through DESC, term ASC')
       .limit(limit)
   end
 
diff --git a/spec/models/search_log_spec.rb b/spec/models/search_log_spec.rb
index d78a880..c98dda0 100644
--- a/spec/models/search_log_spec.rb
+++ b/spec/models/search_log_spec.rb
@@ -204,7 +204,6 @@ RSpec.describe SearchLog, type: :model do
       top_trending = SearchLog.trending.first
       expect(top_trending.term).to eq("ruby")
       expect(top_trending.searches).to eq(3)
-      expect(top_trending.unique_searches).to eq(2)
       expect(top_trending.click_through).to eq(0)
 
       SearchLog.where(term: 'ruby', ip_address: '127.0.0.1').update_all(search_result_id: 12)

GitHub
sha: 9c6f77f9