Class: HomeController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- HomeController
- Defined in:
- app/controllers/home_controller.rb
Instance Attribute Summary
Attributes inherited from ApplicationController
#current_user, #current_user Used for unit testing, this is normally managed by Devise
Instance Method Summary collapse
Methods inherited from ApplicationController
#clear_search_index, #search_params
Instance Method Details
#index ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/home_controller.rb', line 5 def index if current_user limit = 10 #OUR STATUS images = Image.all @image_count = images.count @described_count = images.described.length @description_count = Description.all.count @approved_count = Description.approved.count if current_user.admin? @review_count = Description.ready_to_review.count #@unapproved_count = Description.not_approved.count @open_assignment_count = Image.assigned_undescribed.count @unassigned_undescribed_count = Image.unassigned_undescribed.count @latest_image_timestamp = nil latest_image = Image.except(:order).order(created_at: :desc).first @latest_image_timestamp = latest_image.created_at if latest_image end #YOUR STATUS your_descriptions = current_user.descriptions @your_described_count = current_user.descriptions.collect{|d| d if d.user == current_user}.compact.count @your_approved_count = your_descriptions.approved.count #@your_ready_to_review_count = your_descriptions.ready_to_review.count @your_unapproved_count = your_descriptions.not_approved.count #QUEUES your_images = current_user.images #@your_images_count = your_images.count @your_queue = your_images.collect{|i| i if i.undescribed_by?(current_user)}.compact @your_queue_count = @your_queue.count @your_queue = @your_queue.first(limit) @your_description_ids = current_user.descriptions.map{|d| d.id} if current_user.admin? @unassigned_count = Image.unassigned.count @assigned_count = @image_count - @unassigned_count @unassigned = Image.unassigned.first(limit) @undescribed_count = Image.undescribed.count @undescribed = Image.undescribed.first(limit) @ready_to_review = Description.ready_to_review @ready_to_review_count = @ready_to_review.count @ready_to_review = @ready_to_review.first(limit).collect{|d| d.image}.uniq end else end @minimum_password_length = User.password_length.min end |