Class: Apidae::DashboardController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Apidae::DashboardController
- Defined in:
- app/controllers/apidae/dashboard_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
#apidae_user, #check_user_data!, #user_has_data?, #user_is_admin?
Instance Method Details
#index ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/apidae/dashboard_controller.rb', line 5 def index if user_is_admin? @objects = Obj.count @selections = Selection.count @projects = Project.count @last_imports = FileImport.order(id: :desc).take(100) else projects = Project.where(apidae_id: apidae_user.apidae_projects_ids) selections = Selection.where(apidae_project_id: projects.select(:id).map {|p| p.id}) @projects = projects.count @selections = selections.uniq.count @objects = SelectionObject.where(apidae_selection_id: selections.map {|s| s.id}.uniq).map {|so| so.apidae_object_id}.uniq.count @last_imports = FileImport.where(apidae_id: apidae_user.apidae_projects_ids).order(id: :desc).take(100) end end |