Skip to content
Snippets Groups Projects
Commit c3d334f6 authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

Merge branch 'master' of gitlab.c3sl.ufpr.br:portalmec/portalmec

parents c5fc6c7d acd5b301
No related branches found
No related tags found
No related merge requests found
module Reputationable
extend ActiveSupport::Concern
included do
delegate :count, to: :followers, prefix: true
end
def submitted_objects
learning_objects.count
end
......@@ -8,7 +12,7 @@ module Reputationable
def reviews_score_average
scores = learning_objects.map(&:review_ratings_average)
return 0.0 if scores.size == 0
return 0.0 if scores.empty?
scores.inject(0.0) { |a, e| a + e }.to_f / scores.size.to_f
end
......@@ -35,14 +39,10 @@ module Reputationable
array.inject(0.0) { |a, e| a + e } / array.size
end
def followers_count
followers.count
end
def learning_objects_recently_submitted
return 0.0 if learning_objects.nil?
learning_objects.where('created_at >= ?', (Time.now - 2.months)).count
learning_objects.where('created_at >= ?', (Time.current - 2.months)).count
end
def collections_score_average
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment