aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhellekin <hellekin@cepheide.org>2020-10-09 10:33:41 +0200
committerhellekin <hellekin@cepheide.org>2020-10-09 10:33:41 +0200
commit81b08d9b977837e2e714f9782ba90b664f36b98c (patch)
tree33d0aec63880e906d0422a9156a7c081edb4817c
parent3ea22f64faa08b707d0d4ed6539a5b5debe1f190 (diff)
downloadincommon-map-81b08d9b977837e2e714f9782ba90b664f36b98c.tar.gz
Add some stats
-rw-r--r--app/controllers/welcome_controller.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index 48167b2..ee73270 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -50,6 +50,26 @@ class WelcomeController < ApplicationController
# GET /dashboard
def dashboard
redirect_to '/authenticate' and return unless current_user.present?
+
+ @stats = {
+ counts: {
+ resources: Resource.count,
+ agents: Agent.count,
+ categories: Category.count,
+ sections: Section.count
+ },
+ current_agent: {
+ name: current_agent.name,
+ uuid: current_agent.uuid,
+ counts: {
+ resources: current_agent.resources.count,
+ taxonomies: current_agent.taxonomies.count,
+ categories: current_agent.categories.count,
+ sectiions: current_agent.sections.count
+ }
+ },
+ my_agents: current_user.agents.map { |a| { uuid: a.uuid, name: a.name } }
+ }
end
# GET /logout