Skip to content
Snippets Groups Projects
Commit 149b9677 authored by Bruno Nocera Zanette's avatar Bruno Nocera Zanette
Browse files

Merge branch 'register-views-count' into dspace-solr-search

Conflicts:
	app/controllers/learning_objects_controller.rb
parents 6efa9397 e8477854
No related branches found
No related tags found
No related merge requests found
class LearningObjectsController < ApplicationController class LearningObjectsController < ApplicationController
before_action :set_learning_object, only: [:show, :edit, :update, :destroy] before_action :set_learning_object, only: [:show, :edit, :update, :destroy]
after_action :register_view, only: [:show]
# GET /learning_objects # GET /learning_objects
# GET /learning_objects.json # GET /learning_objects.json
...@@ -12,6 +13,7 @@ class LearningObjectsController < ApplicationController ...@@ -12,6 +13,7 @@ class LearningObjectsController < ApplicationController
def show def show
unless @learning_object.nil? unless @learning_object.nil?
@like_counts = repository.for(:edge).get_in_edges_count "Likes", @learning_object.id @like_counts = repository.for(:edge).get_in_edges_count "Likes", @learning_object.id
@view_counts = repository.for(:edge).get_in_edges_count "Views", @learning_object.id
end end
end end
...@@ -75,4 +77,8 @@ class LearningObjectsController < ApplicationController ...@@ -75,4 +77,8 @@ class LearningObjectsController < ApplicationController
def learning_object_params def learning_object_params
params[:learning_object] params[:learning_object]
end end
def register_view
repository.for(:edge).create_edge('Views', '#14:0', @learning_object.first["@rid"])
end
end end
...@@ -3,4 +3,4 @@ class LearningObject ...@@ -3,4 +3,4 @@ class LearningObject
attr_accessor :id, :id_dspace, :title, :description, :date_creation, attr_accessor :id, :id_dspace, :title, :description, :date_creation,
:thumbnail, :metadata :thumbnail, :metadata
end end
\ No newline at end of file
...@@ -19,7 +19,9 @@ ...@@ -19,7 +19,9 @@
method: :post, method: :post,
params: { from_id: "#14:0", to_id: @learning_object.id } params: { from_id: "#14:0", to_id: @learning_object.id }
)%> )%>
Total Curtir: <%= get_object_property(@like_counts,"COUNT") %> <br>
<p>Total Curtir: <%= get_object_property(@like_counts,"COUNT") %></p>
<p>Total Visualizações: <%= get_object_property(@view_counts,"COUNT") %></p>
<% <%
=begin %> =begin %>
......
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