42 lines
1.3 KiB
Ruby
42 lines
1.3 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
# event
|
|
# 0 - vist
|
|
# 1 - search
|
|
# 2 - pdf generation
|
|
|
|
# site
|
|
# 0 - index
|
|
# 1 - contact
|
|
# 2 - regulamin
|
|
# 3 - umow_konsultacje
|
|
# 4 - monitoring
|
|
# 5 - dotacja
|
|
|
|
# History model
|
|
class VisitHistory < ApplicationRecord
|
|
# == Constants ============================================================
|
|
|
|
# == Attributes ===========================================================
|
|
|
|
# == Extensions ===========================================================
|
|
|
|
# == Relationships ========================================================
|
|
|
|
# == Validations ==========================================================
|
|
|
|
# == Scopes ===============================================================
|
|
scope :visits, -> { where(event: 0) }
|
|
scope :search, -> { where(event: 1) }
|
|
scope :pdf_files, -> { where(event: 2) }
|
|
scope :by_today, -> { where('created_at > ?', Time.now.midnight) }
|
|
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 }
|
|
# == Callbacks ============================================================
|
|
|
|
# == Class Methods ========================================================
|
|
|
|
# == Instance Methods =====================================================
|
|
end
|