Skip to content
Snippets Groups Projects
Commit 88ecd877 authored by Marcela Ribeiro de Oliveira's avatar Marcela Ribeiro de Oliveira
Browse files

change learning_objects_count to return only the published objects

parent 2aa142f1
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,10 @@ class UserSerializer < ActiveModel::Serializer
object.email if (current_user != nil)&&(object.id == current_user.id || current_user.is_admin?)
end
def learning_objects_count
object.learning_objects.where('state = ?', LearningObject.states[:published]).count
end
attributes :id, :email, :provider, :name, :description, :education, :score, :cover, :role_ids, :institution_ids, :avatar, :likes_count, :followed, :complained, :follows_count, :learning_objects_count, :collections_count, :created_at, :updated_at
has_many :subjects
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