Skip to content
Snippets Groups Projects
Commit fbcfcd1f authored by Lucas Gabriel Lima's avatar Lucas Gabriel Lima
Browse files

create highlights method for LearningObject

parent fa9c676c
No related branches found
No related tags found
No related merge requests found
......@@ -131,4 +131,19 @@ class LearningObject < ActiveRecord::Base
def user_category
publisher.try('user_category')
end
#period is either :week or :month
def self.highlights(period, limit)
if period == :week
los = LearningObject.this_week
elsif period == :month
los = LearningObject.this_month
else
los = LearningObject.all
end
los.order(score: :desc)
highlights = los.first(limit)
return highlights
end
end
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