diff --git a/app/controllers/admin/dashboards_controller.rb b/app/controllers/admin/dashboards_controller.rb index e7fd745e8..282d48e15 100644 --- a/app/controllers/admin/dashboards_controller.rb +++ b/app/controllers/admin/dashboards_controller.rb @@ -50,16 +50,6 @@ class Admin::DashboardsController < OrbitBackendController render :json => @usw.uw_diskused_perc.to_s end - def get_month_traffic - result = [] - (0..31).each do |i| - the_day = i.day.ago - visits = Impression.where( created_at: {'$gte' => the_day.beginning_of_day, '$lte' => the_day.end_of_day}).count - result.push({the_day.strftime("%b-%d")=>visits}) - end - render :js => result.to_json - end - protected def get_module_app_count(*args) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f28f15a67..63fd06574 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -242,6 +242,17 @@ module ApplicationHelper display_visitors(created_at: {'$gte' => Date.today.beginning_of_year, '$lte' => Date.today.end_of_year}) end + def get_month_traffic + result = [['Date','Visits']] + (0..30).each do |i| + the_day = i.day.ago + visits = Impression.where( created_at: {'$gte' => the_day.beginning_of_day, '$lte' => the_day.end_of_day}).count + result.push([ the_day.strftime("%b-%d"), visits]) + # result.push({'x'=> i, 'y'=> visits}) + end + result.to_json + end + def display_date_time(object) object.strftime("%Y-%m-%d %H:%M") end diff --git a/app/views/admin/dashboards/_server_loading.erb b/app/views/admin/dashboards/_server_loading.erb index 6ff3fa003..18493cb68 100644 --- a/app/views/admin/dashboards/_server_loading.erb +++ b/app/views/admin/dashboards/_server_loading.erb @@ -2,399 +2,399 @@