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
|
module_app_class = module_app.classify.constantize
|
||||||
objects = module_app_class.order_by(:updated_at, :desc).limit(10)
|
objects = module_app_class.order_by(:updated_at, :desc).limit(10)
|
||||||
objects.each do |object|
|
objects.each do |object|
|
||||||
a.merge!(object => object.updated_at)
|
a.merge!(object => object.updated_at) unless (object.archived rescue nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
|
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
|
module_app_class = module_app.classify.constantize
|
||||||
objects = module_app_class.order_by(:view_count, :desc).limit(10)
|
objects = module_app_class.order_by(:view_count, :desc).limit(10)
|
||||||
objects.each do |object|
|
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
|
||||||
end
|
end
|
||||||
sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
|
sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
|
||||||
|
|
|
@ -181,7 +181,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def display_visitors(options={})
|
def display_visitors(options={})
|
||||||
Impression.where(options).distinct(:session_hash).count
|
Impression.where(options).and(:referrer.ne => nil).distinct(:session_hash).count
|
||||||
end
|
end
|
||||||
|
|
||||||
def display_visitors_today
|
def display_visitors_today
|
||||||
|
|
|
@ -8,7 +8,7 @@ defaults: &defaults
|
||||||
|
|
||||||
development:
|
development:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
database: prototype_r4_ldap0229
|
database: bob
|
||||||
|
|
||||||
test:
|
test:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
|
@ -22,4 +22,4 @@ production:
|
||||||
# password: <%= ENV['MONGOID_PASSWORD'] %>
|
# password: <%= ENV['MONGOID_PASSWORD'] %>
|
||||||
# database: <%= ENV['MONGOID_DATABASE'] %>
|
# database: <%= ENV['MONGOID_DATABASE'] %>
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
database: prototype_r4_ldap0229
|
database: prototype_r4_development
|
||||||
|
|
|
@ -27,6 +27,7 @@ class Impression
|
||||||
private
|
private
|
||||||
|
|
||||||
def update_impressions_counter_cache
|
def update_impressions_counter_cache
|
||||||
|
if self.referrer
|
||||||
impressionable_class = self.impressionable_type.constantize
|
impressionable_class = self.impressionable_type.constantize
|
||||||
|
|
||||||
if impressionable_class.impressionist_counter_cache_options
|
if impressionable_class.impressionist_counter_cache_options
|
||||||
|
@ -35,3 +36,4 @@ class Impression
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
Reference in New Issue