Sha256: 5d2f95d4b8797f7602180d7ff5aa97072aea9744c2e6df2281729f0725e32192

Contents?: true

Size: 306 Bytes

Versions: 20

Compression:

Stored size: 306 Bytes

Contents

module Sufia::UserUsageStats

  def stats
    @stats ||= UserStat.where(user_id: id).order(date: :asc)
  end

  def total_file_views
    stats.reduce(0) { |total, stat| total + stat.file_views }
  end

  def total_file_downloads
    stats.reduce(0) { |total, stat| total + stat.file_downloads }
  end

end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
sufia-models-6.2.0 app/models/concerns/sufia/user_usage_stats.rb
sufia-models-6.1.0 app/models/concerns/sufia/user_usage_stats.rb
sufia-5.0.0 sufia-models/app/models/concerns/sufia/user_usage_stats.rb
sufia-models-5.0.0 app/models/concerns/sufia/user_usage_stats.rb
sufia-models-6.0.0 app/models/concerns/sufia/user_usage_stats.rb
sufia-6.0.0 sufia-models/app/models/concerns/sufia/user_usage_stats.rb
sufia-6.0.0.rc4 sufia-models/app/models/concerns/sufia/user_usage_stats.rb
sufia-models-6.0.0.rc4 app/models/concerns/sufia/user_usage_stats.rb
sufia-6.0.0.rc3 sufia-models/app/models/concerns/sufia/user_usage_stats.rb
sufia-models-6.0.0.rc3 app/models/concerns/sufia/user_usage_stats.rb
sufia-5.0.0.rc1 sufia-models/app/models/concerns/sufia/user_usage_stats.rb
sufia-models-5.0.0.rc1 app/models/concerns/sufia/user_usage_stats.rb
sufia-6.0.0.rc2 sufia-models/app/models/concerns/sufia/user_usage_stats.rb
sufia-models-6.0.0.rc2 app/models/concerns/sufia/user_usage_stats.rb
sufia-6.0.0.rc1 sufia-models/app/models/concerns/sufia/user_usage_stats.rb
sufia-models-6.0.0.rc1 app/models/concerns/sufia/user_usage_stats.rb
sufia-4.3.1 sufia-models/app/models/concerns/sufia/user_usage_stats.rb
sufia-models-4.3.1 app/models/concerns/sufia/user_usage_stats.rb
sufia-6.0.0.beta1 sufia-models/app/models/concerns/sufia/user_usage_stats.rb
sufia-models-6.0.0.beta1 app/models/concerns/sufia/user_usage_stats.rb