Skip to content

Commit

Permalink
fixing top searches
Browse files Browse the repository at this point in the history
  • Loading branch information
cjstewart88 committed Feb 3, 2012
1 parent d2422d5 commit 7efd56f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/stats_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def past_7_days_stats
@past_7_days_stats << ["Favorites" , Favorites.where("created_at >= ?", Date.today-7).count]
@past_7_days_stats << ["Users" , User.where("created_at >= ?", Date.today-7).count]

top_past_7_days_searches = Searches.where("created_at >= ?", Date.today-7).group("what").count
top_past_7_days_searches = Searches.where("created_at >= ? AND search_type != ?", Date.today-7, 'favorites').group("what").count
top_past_7_days_searches.delete("Enter Artist or Band Here")
@top_past_7_days_searches = top_past_7_days_searches.sort_by{ |k, v| -v }[0...5]
end
Expand All @@ -36,7 +36,7 @@ def today_stats
@today_stats << ["Favorites" , Favorites.where("created_at >= ?", Date.today).count]
@today_stats << ["Users" , User.where("created_at >= ?", Date.today).count]

top_searches_today = Searches.where("created_at >= ?", Date.today).group("what").count
top_searches_today = Searches.where("created_at >= ? AND search_type != ?", Date.today, 'favorites').group("what").count
top_searches_today.delete("Enter Artist or Band Here")
@top_searches_today = top_searches_today.sort_by{ |k, v| -v }[0...5]
end
Expand Down

0 comments on commit 7efd56f

Please sign in to comment.