Skip to content
Snippets Groups Projects
Commit e5426032 authored by Lucas Ernesto Kindinger's avatar Lucas Ernesto Kindinger
Browse files

Fix download Edge creation

parent d79a8ff4
No related branches found
No related tags found
No related merge requests found
......@@ -13,8 +13,6 @@ module OrientDb
def increment_views(user, learning_object)
values = {date: sanitize_orientdb_values(Time.now)}
puts "\n\n\n\n\n\n>>>>>>>>>>>>>>>>>>>>>>"
# If doesn't exist edges from user and learning object, create it and increment attribute
if !edge_exists? "Views", user.rid, learning_object.id
create_and_set_edge "Views", user.rid, learning_object.id, values
......@@ -27,14 +25,13 @@ module OrientDb
puts edge
set_values_edge edge["@rid"], values
end
puts "\n\n\n\n\n\n\n\n\n\n\n\n\n"
end
def download(user, learning_object)
download_edge_class = 'Downloads'
values = {date: sanitize_orientdb_values(Time.now)}
create_and_set_edge like_edge_class, user.rid, learning_object.id, values
create_and_set_edge download_edge_class, user.rid, learning_object.id, values
learning_object.downloads = learning_object.downloads + 1
end
......@@ -59,7 +56,7 @@ module OrientDb
# If not liked, like and set date
if !liked? user, learning_object
# The properties of edge. In this case, only date for edge 'Likes'
values = {date: Time.now}
values = {date: sanitize_orientdb_values(Time.now)}
create_and_set_edge like_edge_class, user.rid, learning_object.id, values
learning_object.likes = learning_object.likes + 1
......
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