added views only for index
This commit is contained in:
parent
02c3d5c4ce
commit
542da6aaf0
|
|
@ -20,10 +20,10 @@ class DashboardController < ApplicationController
|
|||
|
||||
def visits_data
|
||||
@monitor << [
|
||||
VisitHistory.visits.count,
|
||||
VisitHistory.visits.by_today.size,
|
||||
VisitHistory.visits.by_7days.size,
|
||||
VisitHistory.visits.by_30days.size
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,12 @@ class VisitHistory < ApplicationRecord
|
|||
scope :by_7days, -> { where('created_at > ?', Time.now.midnight - 7.days) }
|
||||
scope :by_30days, -> { where('created_at > ?', Time.now.midnight - 30.days) }
|
||||
scope :dist_ip, -> { select(:ip_address).uniq }
|
||||
scope :si_index, -> { where(site: 0) }
|
||||
scope :si_contact, -> { where(site: 1) }
|
||||
scope :si_statut, -> { where(site: 2) }
|
||||
scope :si_visit, -> { where(site: 3) }
|
||||
scope :si_monitor, -> { where(site: 4) }
|
||||
scope :si_grant, -> { where(site: 5) }
|
||||
# == Callbacks ============================================================
|
||||
|
||||
# == Class Methods ========================================================
|
||||
|
|
|
|||
Loading…
Reference in New Issue