2013-04-24 11:21:11 +00:00
|
|
|
class DashboardCounter < Resque::Plugins::RestrictionJob
|
2013-07-18 04:03:18 +00:00
|
|
|
include OrbitApp::Module::VisitorCounter
|
|
|
|
|
2013-04-24 11:21:11 +00:00
|
|
|
@queue = :high
|
|
|
|
|
|
|
|
def self.perform(*args)
|
|
|
|
site = Site.first
|
|
|
|
obj = new(*args)
|
|
|
|
site.dashboard_counter[:visitors_this_week] = obj.display_visitors_this_week
|
|
|
|
site.dashboard_counter[:visitors_this_month] = obj.display_visitors_this_month
|
|
|
|
site.dashboard_counter[:visitors_this_year] = obj.display_visitors_this_year
|
|
|
|
site.save
|
2013-05-14 02:29:11 +00:00
|
|
|
OrbitLogger.info "DashboardCounter done #{site.dashboard_counter.to_s}"
|
2013-04-24 11:21:11 +00:00
|
|
|
|
2013-07-18 04:03:18 +00:00
|
|
|
#Notice this is mainly used at user dashbroad. however the code there is currentlly using realtime evaluation.
|
|
|
|
#and the site model will need a field call dashboard_counter to complete this job.
|
2013-04-24 11:21:11 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|