Skip to content
Snippets Groups Projects
Commit 0bf4b00a authored by Matheus Agio Nerone's avatar Matheus Agio Nerone
Browse files

now objects are linked to the user that published it

parent 691738c4
No related branches found
No related tags found
No related merge requests found
...@@ -39,8 +39,13 @@ class LearningObjectBuilder ...@@ -39,8 +39,13 @@ class LearningObjectBuilder
type: args['type'], type: args['type'],
bitstreams: args['bitstreams'], bitstreams: args['bitstreams'],
last_modified: args['last_modified'], last_modified: args['last_modified'],
metadata: JSON.parse(args['metadata'])
) )
if args['metadata'] == 'null'
obj.metadata = []
else
obj.metadata = JSON.parse(args['metadata'])
end
obj.created_at = DateTime.strptime(args['created_at'], "%Y-%m-%d %H:%M:%S") unless args['created_at'].nil? obj.created_at = DateTime.strptime(args['created_at'], "%Y-%m-%d %H:%M:%S") unless args['created_at'].nil?
obj.last_modified = DateTime.strptime(args['last_modified'], "%Y-%m-%d %H:%M:%S") unless args['last_modified'].nil? obj.last_modified = DateTime.strptime(args['last_modified'], "%Y-%m-%d %H:%M:%S") unless args['last_modified'].nil?
obj.published_at = DateTime.strptime(args['published_at'], "%Y-%m-%d %H:%M:%S") unless args['published_at'].nil? obj.published_at = DateTime.strptime(args['published_at'], "%Y-%m-%d %H:%M:%S") unless args['published_at'].nil?
......
...@@ -36,6 +36,7 @@ class LearningObjectsController < ApplicationController ...@@ -36,6 +36,7 @@ class LearningObjectsController < ApplicationController
@learning_object = LearningObject.new(learning_object_params) @learning_object = LearningObject.new(learning_object_params)
@learning_object.subjects = subjects @learning_object.subjects = subjects
@learning_object.created_at = Time.now @learning_object.created_at = Time.now
@learning_object.last_modified = Time.now
@learning_object.type = 'video' @learning_object.type = 'video'
@learning_object.author = current_user.name @learning_object.author = current_user.name
@learning_object.publisher = current_user @learning_object.publisher = current_user
......
...@@ -19,8 +19,7 @@ class UsersController < ApplicationController ...@@ -19,8 +19,7 @@ class UsersController < ApplicationController
end end
def me def me
asd @objects = learning_object_repository.all(current_user)
@objects = current_user.learning_objects
@bookmarks = current_user.bookmarks @bookmarks = current_user.bookmarks
@groups = [ @groups = [
CollectionsGroup.new(title: 'Coleções Automáticas', CollectionsGroup.new(title: 'Coleções Automáticas',
......
...@@ -132,16 +132,8 @@ module OrientDb ...@@ -132,16 +132,8 @@ module OrientDb
build_object result.first build_object result.first
end end
##
# This method return all learning objects of +user+ scope.
#
# No users have objects.
# Learning Object submission was not implemented yet.
# For now, an empty array is returned.
def all(user) def all(user)
#result = select_by_property(odb_class, "p_id", user.id) build_objects(get_edges_end('PublishedBy', 'in', user.rid) || [])
#build_objects result
[]
end end
def all_by_score_from_offset_to_limit(offset, limit) def all_by_score_from_offset_to_limit(offset, limit)
......
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