Change impression count to exclude when :referrer is nil
This commit is contained in:
parent
d9c12ea5a4
commit
7c6b807170
|
@ -30,7 +30,7 @@ class Admin::DashboardsController < ApplicationController
|
|||
module_app_class = module_app.classify.constantize
|
||||
objects = module_app_class.order_by(:updated_at, :desc).limit(10)
|
||||
objects.each do |object|
|
||||
a.merge!(object => object.updated_at)
|
||||
a.merge!(object => object.updated_at) unless (object.archived rescue nil)
|
||||
end
|
||||
end
|
||||
sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
|
||||
|
@ -43,7 +43,7 @@ class Admin::DashboardsController < ApplicationController
|
|||
module_app_class = module_app.classify.constantize
|
||||
objects = module_app_class.order_by(:view_count, :desc).limit(10)
|
||||
objects.each do |object|
|
||||
a.merge!(object => object.view_count) if object.view_count > 0
|
||||
a.merge!(object => object.view_count) if object.view_count > 0 && (!object.archived rescue true)
|
||||
end
|
||||
end
|
||||
sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
|
||||
|
|
|
@ -181,7 +181,7 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def display_visitors(options={})
|
||||
Impression.where(options).distinct(:session_hash).count
|
||||
Impression.where(options).and(:referrer.ne => nil).distinct(:session_hash).count
|
||||
end
|
||||
|
||||
def display_visitors_today
|
||||
|
|
|
@ -8,7 +8,7 @@ defaults: &defaults
|
|||
|
||||
development:
|
||||
<<: *defaults
|
||||
database: prototype_r4_ldap0229
|
||||
database: bob
|
||||
|
||||
test:
|
||||
<<: *defaults
|
||||
|
@ -22,4 +22,4 @@ production:
|
|||
# password: <%= ENV['MONGOID_PASSWORD'] %>
|
||||
# database: <%= ENV['MONGOID_DATABASE'] %>
|
||||
<<: *defaults
|
||||
database: prototype_r4_ldap0229
|
||||
database: prototype_r4_development
|
||||
|
|
|
@ -27,11 +27,13 @@ class Impression
|
|||
private
|
||||
|
||||
def update_impressions_counter_cache
|
||||
impressionable_class = self.impressionable_type.constantize
|
||||
if self.referrer
|
||||
impressionable_class = self.impressionable_type.constantize
|
||||
|
||||
if impressionable_class.impressionist_counter_cache_options
|
||||
resouce = impressionable_class.find(self.impressionable_id)
|
||||
resouce.try(:update_impressionist_counter_cache)
|
||||
if impressionable_class.impressionist_counter_cache_options
|
||||
resouce = impressionable_class.find(self.impressionable_id)
|
||||
resouce.try(:update_impressionist_counter_cache)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Reference in New Issue