class DashboardController < ApplicationController
  def index
    @monitor = []
    general_data
    visits_data
    pdfs_data
    search_data
  end

  private

  def general_data
    @monitor << [
      Dotation.all.size,
      Dotation.public_dot.size,
      FilterForEmail.all.size,
      EmailMessage.all.size
    ]
  end

  def visits_data
    @monitor << [
      VisitHistory.visits.si_index.count,
      VisitHistory.visits.si_index.by_today.size,
      VisitHistory.visits.si_index.by_7days.size,
      VisitHistory.visits.si_index.by_30days.size
    ]
  end

  def pdfs_data
    @monitor << [
      VisitHistory.pdf_files.count,
      VisitHistory.pdf_files.by_today.size,
      VisitHistory.pdf_files.by_7days.size,
      VisitHistory.pdf_files.by_30days.size
    ]
  end

  def search_data
    @monitor << [
      VisitHistory.search.count,
      VisitHistory.search.by_today.size,
      VisitHistory.search.by_7days.size,
      VisitHistory.search.by_30days.size
    ]
  end
end
