diff --git a/app/assets/javascripts/management.js b/app/assets/javascripts/management.js index 15c071412093ee26b9afa4e7bafe2f063865fa0b..18dfb4b228f40b77cbd57316bdbd77150eb614cf 100644 --- a/app/assets/javascripts/management.js +++ b/app/assets/javascripts/management.js @@ -25,14 +25,15 @@ $(document).ready(function(){ if (document.getElementById("lobject") !== null) { visualised = document.getElementById("lobject").value; non_visualised = document.getElementById("lobject_non").value; - var data_learning_objects = dataLearningObjects(visualised,non_visualised); + } + if (document.getElementById("n_teachers") !== null) { teachers = document.getElementById("n_teachers").value; curators = document.getElementById("n_curators").value; admins = document.getElementById("n_admins").value; - var data_users = dataUsers(teachers,curators,admins); + } var charts = ["colections","users","learning_objects","accesses"]; @@ -51,7 +52,7 @@ $(document).ready(function(){ break; case "learning_objects": new Chart(ctx).Pie(data_learning_objects,pie_options); - var learning_objects_chart = new Chart(ctx).Pie(data_learnin_objects); + var learning_objects_chart = new Chart(ctx).Pie(data_learning_objects); break; case "accesses": new Chart(ctx).Line(data_accesses,line_options); @@ -64,7 +65,7 @@ $(document).ready(function(){ } } } -}); +); Chart.defaults.global = { // Boolean - Whether to animate the chart diff --git a/app/assets/javascripts/management/users.js b/app/assets/javascripts/management/users.js index 375d75a61d473268c64b0a15f9a8bf0eb2dbd8b2..b1de9842736a54e3402762e8acc8df156c71f81e 100644 --- a/app/assets/javascripts/management/users.js +++ b/app/assets/javascripts/management/users.js @@ -3,20 +3,20 @@ //mais infos www.chartjs.org/docs/ function dataUsers(teachers, curators, admins){ -var data_users = { +var data = { labels: [ "Professores", "Curadores", "Admnistradores"], datasets: [ { label: "My First dataset", - fillColor: "rgba(220,220,220,0.5)", - strokeColor: "rgba(220,220,220,0.8)", - highlightFill: "rgba(220,220,220,0.75)", - highlightStroke: "rgba(220,220,220,1)", + fillColor: "rgba(100,89,54,0.5)", + strokeColor: "rgba(1,34,65,0.8)", + highlightFill: "rgba(53,13,54,0.75)", + highlightStroke: "rgba(32,80,90,1)", data: [teachers, curators, admins] }, ] }; -return data +return data; } diff --git a/app/controllers/management/statistics_controller.rb b/app/controllers/management/statistics_controller.rb index 6bd679f439f414f30b860b1f071bc64cf962598c..83b585b243e7a89ec5dfa21815713defc1369f52 100644 --- a/app/controllers/management/statistics_controller.rb +++ b/app/controllers/management/statistics_controller.rb @@ -35,6 +35,7 @@ class Management::StatisticsController < ManagementController @n_teachers +=1 end end + end def downloads @@ -45,6 +46,7 @@ class Management::StatisticsController < ManagementController #usar o logstash e kibana #enquanto isso, uso o sign_in_count do ActiveRecord @total= User.sum("sign_in_count") + end @@ -62,6 +64,7 @@ class Management::StatisticsController < ManagementController if @@flag == 0 || @@user != current_user @@user = current_user @@flag = 1 + set_statistics end @n_learning_objects = @@n_learning_objects @most_visualised = @@most_visualised @@ -76,7 +79,7 @@ class Management::StatisticsController < ManagementController @@n_learning_objects = learning_object_repository.count_all || [] @@n_non_visualised = learning_object_repository.get_number_of_non_visualised || [] @@most_visualised = learning_object_repository.get_most_visualised || [] - @@n_views = main_page_repository.get_number_of("Views") || [] + @@n_views = learning_object_repository.get_number_of("Views") || [] end def views diff --git a/app/views/management/statistics/accesses.html.erb b/app/views/management/statistics/accesses.html.erb index ccd0a2a4337575d6b5471b338cced3b06e7986d6..832f73d8c15cd28d870c084c15bd8736558df3d5 100644 --- a/app/views/management/statistics/accesses.html.erb +++ b/app/views/management/statistics/accesses.html.erb @@ -14,7 +14,7 @@ <div id="sending-stats" class="row"> <div class="col-sm-6 col-md-12"> <div class="ls-box"> - <h6 class="ls-title-6">Total</h6> + <h6 class="ls-title-6">Total de acessos dos usuários</h6> <strong class="ls-color-theme"><%= @total %></strong> </div> </div> diff --git a/app/views/management/statistics/learning_objects.html.erb b/app/views/management/statistics/learning_objects.html.erb index e4712af21ac53f4e36e09dbe5f25ec6a5706769f..999870e07de6c60c307478b9c926e4957adaaae6 100644 --- a/app/views/management/statistics/learning_objects.html.erb +++ b/app/views/management/statistics/learning_objects.html.erb @@ -39,7 +39,7 @@ <input type="hidden" id="lobject" value="<%= @n_learning_objects - @n_non_visualised %>"/> -<input type="hidden" id="lobject_non" value="<%= @n_non_visualised %>"/>3 +<input type="hidden" id="lobject_non" value="<%= @n_non_visualised %>"/> diff --git a/app/views/management/statistics/users.html.erb b/app/views/management/statistics/users.html.erb index 8a00f7b8a6636fbfa95d48f1bb8a4348e7bb723c..0956e47123042f8bd27093926bdd3e865c5bc3f9 100644 --- a/app/views/management/statistics/users.html.erb +++ b/app/views/management/statistics/users.html.erb @@ -20,7 +20,7 @@ </div> </div> - <div class="col-sm-6 col-md-2"> + <div class="col-sm-6 col-md-4"> <div class="ls-box"> <h6 class="ls-title-4">Professores</h6> <strong class="ls-color-theme"><%=@n_teachers%></strong> @@ -29,20 +29,20 @@ </div> - <div class="col-sm-6 col-md-2"> + <div class="col-sm-6 col-md-4"> <div class="ls-box"> <h6 class="ls-title-4 ">Curadores</h6> - <strong class="ls-color-theme"><%@n_curators%></strong> + <strong class="ls-color-theme"><%=@n_curators%></strong> <%#= link_to "Mais detalhes" , management_statistics_acessos_path, class: "ls-btn ls-btn-sm" %> </div> </div> - <div class="col-sm-6 col-md-3"> + <div class="col-sm-6 col-md-4"> <div class="ls-box"> <h6 class="ls-title-4 ">Administradores</h6> - <strong class="ls-color-theme"><%@n_admins%></strong> + <strong class="ls-color-theme"><%=@n_admins%></strong> </div> </div>