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.2.7 app/controllers/apidae/dashboard_controller.rb
apidae-1.2.6 app/controllers/apidae/dashboard_controller.rb
apidae-1.2.5 app/controllers/apidae/dashboard_controller.rb
apidae-1.3.0 app/controllers/apidae/dashboard_controller.rb
apidae-1.2.4 app/controllers/apidae/dashboard_controller.rb
apidae-1.2.3 app/controllers/apidae/dashboard_controller.rb
apidae-1.2.2 app/controllers/apidae/dashboard_controller.rb
apidae-1.2.1 app/controllers/apidae/dashboard_controller.rb
apidae-1.2.0 app/controllers/apidae/dashboard_controller.rb
apidae-1.1.2 app/controllers/apidae/dashboard_controller.rb
apidae-1.1.1 app/controllers/apidae/dashboard_controller.rb
apidae-1.1.0 app/controllers/apidae/dashboard_controller.rb
apidae-1.0.5 app/controllers/apidae/dashboard_controller.rb