Class: Hyrax::FileUsage
- Inherits:
-
StatsUsagePresenter
- Object
- StatsUsagePresenter
- Hyrax::FileUsage
- Defined in:
- app/presenters/hyrax/file_usage.rb
Overview
Called by the stats controller, it finds cached file pageview data, and prepares it for visualization in /app/views/stats/file.html.erb
Instance Attribute Summary
Attributes inherited from StatsUsagePresenter
Instance Method Summary collapse
-
#initialize(id) ⇒ FileUsage
constructor
A new instance of FileUsage.
-
#to_flot ⇒ Object
Package data for visualization using JQuery Flot.
- #total_downloads ⇒ Object
- #total_pageviews ⇒ Object
Methods inherited from StatsUsagePresenter
Constructor Details
Instance Method Details
#to_flot ⇒ Object
Package data for visualization using JQuery Flot
22 23 24 25 26 27 |
# File 'app/presenters/hyrax/file_usage.rb', line 22 def to_flot [ { label: "Pageviews", data: pageviews }, { label: "Downloads", data: downloads } ] end |
#total_downloads ⇒ Object
13 14 15 |
# File 'app/presenters/hyrax/file_usage.rb', line 13 def total_downloads downloads.reduce(0) { |total, result| total + result[1].to_i } end |
#total_pageviews ⇒ Object
17 18 19 |
# File 'app/presenters/hyrax/file_usage.rb', line 17 def total_pageviews pageviews.reduce(0) { |total, result| total + result[1].to_i } end |