Class: FileViewStat

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
Sufia::FileStatUtils
Defined in:
app/models/file_view_stat.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Sufia::FileStatUtils

convert_date, to_flots

Class Method Details

.ga_statistics(start_date, file_id) ⇒ Object

Sufia::Download is sent to Sufia::Analytics.profile as #sufia__download see Legato::ProfileMethods.method_name_from_klass



14
15
16
17
# File 'app/models/file_view_stat.rb', line 14

def self.ga_statistics start_date, file_id
  path = Sufia::Engine.routes.url_helpers.generic_file_path(Sufia::Noid.noidify(file_id))
  Sufia::Analytics.profile.sufia__pageview(sort: 'date', start_date: start_date).for_path(path)
end

.statistics(file_id, start_date) ⇒ Object



8
9
10
# File 'app/models/file_view_stat.rb', line 8

def self.statistics file_id, start_date
  combined_stats file_id, start_date, :views, :pageviews
end

Instance Method Details

#to_flotObject



4
5
6
# File 'app/models/file_view_stat.rb', line 4

def to_flot
  [ self.class.convert_date(date), views ]
end