Class: ThinkFeelDoEngine::Coach::PatientDashboardsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/think_feel_do_engine/coach/patient_dashboards_controller.rb

Overview

Manages the Participant dashboard for Coaches.

Constant Summary

Constants inherited from ApplicationController

ApplicationController::CSRF_COOKIE_NAME, ApplicationController::CSRF_HEADER_NAME, ApplicationController::INACTIVE_MESSAGE, ApplicationController::ROOT_URI

Instance Method Summary collapse

Methods inherited from ApplicationController

#access_denied_resource_path, #after_sign_in_path_for, #after_sign_out_path_for, #raise_not_found!, #render_not_found

Instance Method Details

#indexObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/think_feel_do_engine/coach/patient_dashboards_controller.rb', line 11

def index
  authorize! :show, Participant
  if params[:active] == "false"
    @active_patients = false
    @participants = Participant
                    .joins(:memberships)
                    .where("memberships.group_id = ?", @group.id)
                    .inactive
  else
    @active_patients = true
    @participants = Participant
                    .joins(:memberships)
                    .where("memberships.group_id = ? AND " \
                           "memberships.is_complete = false", @group.id)
                    .active
  end
end

#showObject



29
30
31
32
33
# File 'app/controllers/think_feel_do_engine/coach/patient_dashboards_controller.rb', line 29

def show
  authorize! :show, @participant
  @lesson_events = ThinkFeelDoEngine::Reports::LessonViewing
                   .all(@participant.id)
end