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

move LearningObjectRepository#get_attributes implementation for...

move LearningObjectRepository#get_attributes implementation for AttributeRepository#find_all_by_learning_object
parent da806e8c
No related branches found
No related tags found
No related merge requests found
...@@ -48,7 +48,7 @@ module OrientDb ...@@ -48,7 +48,7 @@ module OrientDb
key = 'learning_objects/all/score/' + offset.to_s + '/' + limit.to_s key = 'learning_objects/all/score/' + offset.to_s + '/' + limit.to_s
objects_hash = Rails.cache.fetch(key, expires_in: 6.hours) do objects_hash = Rails.cache.fetch(key, expires_in: 6.hours) do
objects = connection.query "SELECT FROM LearningObject ORDER BY score DESC LIMIT #{limit} SKIP #{offset}", limit: limit objects = connection.query "SELECT FROM LearningObject ORDER BY score DESC LIMIT #{limit} SKIP #{offset}", limit: limit
objects.map { |o| { 'rid' => o['@rid'] } } objects.map { |o| {'rid' => o['@rid']} }
end end
LearningObjectBuilder.build(objects_hash) LearningObjectBuilder.build(objects_hash)
...@@ -60,8 +60,7 @@ module OrientDb ...@@ -60,8 +60,7 @@ module OrientDb
end end
def get_attributes(learning_object) def get_attributes(learning_object)
result = get_edges_end("HasAttr", "out", learning_object.id) attribute_repository.find_all_by_learning_object learning_object
attribute_repository.build_objects(result)
end end
def create_relations(learning_object) def create_relations(learning_object)
......
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