Fix visitor count. Mapping the session and making sure they were unique using rails was way slower than doing it with a mongoid query

This commit is contained in:
chris 2013-07-19 01:20:51 +08:00
parent b1d8a87256
commit 3a91c92bf7
1 changed files with 1 additions and 2 deletions

View File

@ -4,8 +4,7 @@ module OrbitApp
Version = "0.1"
def display_visitors(options={})
impressions = Impression.where(options).and(:referrer.ne => nil)
impressions.map{|i| i[:session_hash]}.uniq.count
impressions = Impression.where(options).and(:referrer.ne => nil).distinct(:session_hash).count
end
def display_visitors_today