Class: Dashboard
- Inherits:
-
Object
- Object
- Dashboard
- Defined in:
- app/presenters/dashboard.rb
Overview
A Plain Old Ruby Object (PORO) responsible for organizing various Organization dashboard details. Uses many scopes defined on Organization and User.
Instance Method Summary collapse
-
#current_user_approved_representation_count ⇒ Integer
Total number of approved representations written by the current user.
-
#current_user_assigned_items_count ⇒ Integer
Total number of items assigned to the user.
-
#current_user_open_assignments_count ⇒ Itnger
Total number of resources assigned to the user which do not have a representation.
-
#current_user_queue_empty? ⇒ Boolean
Whether or not the user has any assigned items.
-
#current_user_representation_count ⇒ Integer
Total number of representations written by the current user.
-
#current_user_represented_resources_count ⇒ Integer
Total number of resources represented by the current user.
-
#current_user_top_assigned_items_queue ⇒ ActiveRecord::Associations::CollectionProxy
A subset of the most important resources assigned to the user for representation.
-
#current_user_unapproved_representation_count ⇒ Integer
Total number of unapproved representations written by the current user.
-
#initialize(current_user, organization) ⇒ Dashboard
constructor
A new instance of Dashboard.
-
#organization_approved_representation_count ⇒ Integer
Total number of approved representations owned by the organization.
-
#organization_assigned_count ⇒ Integer
Total number of resources owned by the organization which have been assigned to a user for representation.
-
#organization_latest_resource_timestamp ⇒ Object
Identifies the time when the most recently-created resource was added to the database, if any have been created.
-
#organization_open_assignment_count ⇒ Integer
Total number of resources that have been assigned to a user for representation, which are as-yet-unrepresented.
-
#organization_ready_to_review_count ⇒ Integer
Total number of ready-to-review representations owned by the organization.
-
#organization_representation_count ⇒ Integer
Total number of representations owned by the organization.
-
#organization_represented_resource_count ⇒ Integer
Total number of represented resources owned by the organization.
-
#organization_resource_count ⇒ Integer
Total number of resources owned by the organization.
-
#organization_top_ready_to_review_items_queue ⇒ ActiveRecord::Associations::CollectionProxy
A subset of the most important resources assigned to the user for representation.
-
#organization_top_unassigned_items_queue ⇒ ActiveRecord::Associations::CollectionProxy
A subset of the most important resources assigned to the user for representation.
-
#organization_top_unrepresented_items_queue ⇒ ActiveRecord::Associations::CollectionProxy
A subset of the most important resources assigned to the user for representation.
-
#organization_unapproved_representation_count ⇒ Integer
Total number of unapproved representations owned by the organization.
-
#organization_unassigned_count ⇒ Integer
Total number of resources owned by the organization which have not been assigned to a user for representation.
-
#organization_unassigned_unrepresented_count ⇒ Integer
Total number of resources that are unrepresented and have not been assigned to a user for representation.
-
#organization_unrepresented_count ⇒ Integer
Total number of unrepresented resources owned by the organization.
-
#organization_users ⇒ ActiveRecord::Associations::CollectionProxy
All of the users in the organization.
Constructor Details
#initialize(current_user, organization) ⇒ Dashboard
Returns a new instance of Dashboard
9 10 11 12 |
# File 'app/presenters/dashboard.rb', line 9 def initialize(current_user, organization) @current_user = current_user @organization = organization end |
Instance Method Details
#current_user_approved_representation_count ⇒ Integer
Returns total number of approved representations written by the current user
105 106 107 |
# File 'app/presenters/dashboard.rb', line 105 def current_user_approved_representation_count current_user..approved.count end |
#current_user_assigned_items_count ⇒ Integer
Returns total number of items assigned to the user
126 127 128 |
# File 'app/presenters/dashboard.rb', line 126 def current_user_assigned_items_count current_user_assigned_items_queue.count end |
#current_user_open_assignments_count ⇒ Itnger
Returns total number of resources assigned to the user which do not have a representation
115 116 117 |
# File 'app/presenters/dashboard.rb', line 115 def current_user_open_assignments_count current_user.assigned_resources.unrepresented.count end |
#current_user_queue_empty? ⇒ Boolean
Returns whether or not the user has any assigned items
131 132 133 |
# File 'app/presenters/dashboard.rb', line 131 def current_user_queue_empty? current_user_assigned_items_queue.empty? end |
#current_user_representation_count ⇒ Integer
Returns total number of representations written by the current user
100 101 102 |
# File 'app/presenters/dashboard.rb', line 100 def current_user_representation_count current_user..count end |
#current_user_represented_resources_count ⇒ Integer
Returns total number of resources represented by the current user
95 96 97 |
# File 'app/presenters/dashboard.rb', line 95 def current_user_represented_resources_count current_user.resources.represented_by(current_user).count end |
#current_user_top_assigned_items_queue ⇒ ActiveRecord::Associations::CollectionProxy
Returns a subset of the most important resources assigned to the user for representation
121 122 123 |
# File 'app/presenters/dashboard.rb', line 121 def current_user_top_assigned_items_queue current_user_assigned_items_queue.first(top_items_queue_size) end |
#current_user_unapproved_representation_count ⇒ Integer
Returns total number of unapproved representations written by the current user
110 111 112 |
# File 'app/presenters/dashboard.rb', line 110 def current_user_unapproved_representation_count current_user..not_approved.count end |
#organization_approved_representation_count ⇒ Integer
Returns total number of approved representations owned by the organization
30 31 32 |
# File 'app/presenters/dashboard.rb', line 30 def organization_approved_representation_count organization.representations.approved.count end |
#organization_assigned_count ⇒ Integer
Returns total number of resources owned by the organization which have been assigned to a user for representation
60 61 62 |
# File 'app/presenters/dashboard.rb', line 60 def organization_assigned_count organization.resources.assigned.count end |
#organization_latest_resource_timestamp ⇒ Object
Identifies the time when the most recently-created resource was added to the database, if any have been created
66 67 68 |
# File 'app/presenters/dashboard.rb', line 66 def organization.resources. end |
#organization_open_assignment_count ⇒ Integer
Returns total number of resources that have been assigned to a user for representation, which are as-yet-unrepresented
40 41 42 |
# File 'app/presenters/dashboard.rb', line 40 def organization_open_assignment_count organization.resources.assigned_unrepresented.count end |
#organization_ready_to_review_count ⇒ Integer
Returns total number of ready-to-review representations owned by the organization
50 51 52 |
# File 'app/presenters/dashboard.rb', line 50 def organization_ready_to_review_count organization_ready_to_review_queue.count end |
#organization_representation_count ⇒ Integer
Returns total number of representations owned by the organization
20 21 22 |
# File 'app/presenters/dashboard.rb', line 20 def organization_representation_count organization.representations.count end |
#organization_represented_resource_count ⇒ Integer
Returns total number of represented resources owned by the organization
25 26 27 |
# File 'app/presenters/dashboard.rb', line 25 def organization_represented_resource_count organization.resources.represented.count end |
#organization_resource_count ⇒ Integer
Returns total number of resources owned by the organization
15 16 17 |
# File 'app/presenters/dashboard.rb', line 15 def organization_resource_count organization.resources.count end |
#organization_top_ready_to_review_items_queue ⇒ ActiveRecord::Associations::CollectionProxy
You can control how many items are shown from the queue via the Rails.configuration.x.dashboard_top_items_queue_size setting in config/application.rb
Returns a subset of the most important resources assigned to the user for representation
90 91 92 |
# File 'app/presenters/dashboard.rb', line 90 def organization_top_ready_to_review_items_queue organization_ready_to_review_queue.first(top_items_queue_size) end |
#organization_top_unassigned_items_queue ⇒ ActiveRecord::Associations::CollectionProxy
You can control how many items are shown from the queue via the Rails.configuration.x.dashboard_top_items_queue_size setting in config/application.rb
Returns a subset of the most important resources assigned to the user for representation
84 85 86 |
# File 'app/presenters/dashboard.rb', line 84 def organization_top_unassigned_items_queue organization_unassigned_queue.first(top_items_queue_size) end |
#organization_top_unrepresented_items_queue ⇒ ActiveRecord::Associations::CollectionProxy
You can control how many items are shown from the queue via the Rails.configuration.x.dashboard_top_items_queue_size setting in config/application.rb
Returns a subset of the most important resources assigned to the user for representation
78 79 80 |
# File 'app/presenters/dashboard.rb', line 78 def organization_top_unrepresented_items_queue organization_unrepresented_queue.first(top_items_queue_size) end |
#organization_unapproved_representation_count ⇒ Integer
Returns total number of unapproved representations owned by the organization
35 36 37 |
# File 'app/presenters/dashboard.rb', line 35 def organization_unapproved_representation_count organization.representations.not_approved.count end |
#organization_unassigned_count ⇒ Integer
Returns total number of resources owned by the organization which have not been assigned to a user for representation
71 72 73 |
# File 'app/presenters/dashboard.rb', line 71 def organization_unassigned_count organization_unassigned_queue.count end |
#organization_unassigned_unrepresented_count ⇒ Integer
Returns total number of resources that are unrepresented and have not been assigned to a user for representation
45 46 47 |
# File 'app/presenters/dashboard.rb', line 45 def organization_unassigned_unrepresented_count organization.resources.unassigned_unrepresented.count end |
#organization_unrepresented_count ⇒ Integer
Returns total number of unrepresented resources owned by the organization
55 56 57 |
# File 'app/presenters/dashboard.rb', line 55 def organization_unrepresented_count organization_unrepresented_queue.count end |
#organization_users ⇒ ActiveRecord::Associations::CollectionProxy
Returns all of the users in the organization
136 137 138 |
# File 'app/presenters/dashboard.rb', line 136 def organization_users organization.users.sorted end |