Sha256: d057188d2391b292f0084a4c48d6ebc8533d8f6e4e47567cf806d970e512b44a

Contents?: true

Size: 855 Bytes

Versions: 73

Compression:

Stored size: 855 Bytes

Contents

require_dependency "apidae/application_controller"

module Apidae
  class DashboardController < ApplicationController
    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
  end
end

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
apidae-1.4.13 app/controllers/apidae/dashboard_controller.rb
apidae-1.4.12 app/controllers/apidae/dashboard_controller.rb
apidae-1.4.11 app/controllers/apidae/dashboard_controller.rb
apidae-1.4.10 app/controllers/apidae/dashboard_controller.rb
apidae-1.4.9 app/controllers/apidae/dashboard_controller.rb
apidae-1.4.8 app/controllers/apidae/dashboard_controller.rb
apidae-1.4.7 app/controllers/apidae/dashboard_controller.rb
apidae-1.4.6 app/controllers/apidae/dashboard_controller.rb
apidae-1.4.5 app/controllers/apidae/dashboard_controller.rb
apidae-1.4.4 app/controllers/apidae/dashboard_controller.rb
apidae-1.4.3 app/controllers/apidae/dashboard_controller.rb
apidae-1.2.35 app/controllers/apidae/dashboard_controller.rb
apidae-1.2.34 app/controllers/apidae/dashboard_controller.rb
apidae-1.2.33 app/controllers/apidae/dashboard_controller.rb
apidae-1.4.2 app/controllers/apidae/dashboard_controller.rb
apidae-1.4.1 app/controllers/apidae/dashboard_controller.rb
apidae-1.4.0 app/controllers/apidae/dashboard_controller.rb
apidae-1.2.32 app/controllers/apidae/dashboard_controller.rb
apidae-1.2.31 app/controllers/apidae/dashboard_controller.rb
apidae-1.2.30 app/controllers/apidae/dashboard_controller.rb