2013-04-24 11:21:11 +00:00
|
|
|
class DashboardCounter < Resque::Plugins::RestrictionJob
|
2013-07-19 08:59:08 +00:00
|
|
|
extend OrbitApp::Module::VisitorCounterEval
|
2013-07-18 04:03:18 +00:00
|
|
|
|
2013-04-24 11:21:11 +00:00
|
|
|
@queue = :high
|
|
|
|
|
|
|
|
def self.perform(*args)
|
|
|
|
site = Site.first
|
|
|
|
obj = new(*args)
|
2013-07-19 08:59:08 +00:00
|
|
|
site.visitor_counters[:total] = display_visitors
|
|
|
|
site.visitor_counters[:today] = display_visitors_today
|
|
|
|
site.visitor_counters[:this_week] = display_visitors_this_week
|
|
|
|
site.visitor_counters[:this_month] = display_visitors_this_month
|
|
|
|
site.visitor_counters[:this_year] = display_visitors_this_year
|
2013-04-24 11:21:11 +00:00
|
|
|
site.save
|
2013-07-19 08:59:08 +00:00
|
|
|
OrbitLogger.info "DashboardCounter done #{site.visitor_counters.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
|