Module: ThinkFeelDoEngine::Coach::PatientDashboardHelper

Defined in:
app/helpers/think_feel_do_engine/coach/patient_dashboard_helper.rb

Overview

Displays navigational information in the form of breadcrumbs

Constant Summary collapse

VISUALIZATION_CONTROLLERS =
%w(
  participant_activities_visualizations
  participant_thoughts_visualizations
).freeze

Instance Method Summary collapse

Instance Method Details

#activities_planned_7_day(participant) ⇒ Object



43
44
45
46
47
48
49
50
# File 'app/helpers/think_feel_do_engine/coach/patient_dashboard_helper.rb', line 43

def activities_planned_7_day(participant)
  participant.activities
             .planned.created_last_seven_days.count +
    participant.activities
    .reviewed_and_complete.created_last_seven_days.count +
    participant.activities
    .reviewed_and_incomplete.created_last_seven_days.count
end

#activities_planned_today(participant) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'app/helpers/think_feel_do_engine/coach/patient_dashboard_helper.rb', line 32

def activities_planned_today(participant)
  participant
    .activities.planned.created_for_day(Time.zone.today).count +
    participant
    .activities
    .reviewed_and_complete.created_for_day(Time.zone.today).count +
    participant
    .activities
    .reviewed_and_incomplete.created_for_day(Time.zone.today).count
end

#activities_planned_total(participant) ⇒ Object



52
53
54
55
56
# File 'app/helpers/think_feel_do_engine/coach/patient_dashboard_helper.rb', line 52

def activities_planned_total(participant)
  participant.activities.planned.count +
    participant.activities.reviewed_and_complete.count +
    participant.activities.reviewed_and_incomplete.count
end


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

def breadcrumbs
  return unless VISUALIZATION_CONTROLLERS.include?(controller_name)

  dashboard_path = coach_group_patient_dashboard_path(
    @group,
    @participant
  )

  content_for(
    :breadcrumbs,
    (
      :ol,
      (
        :li,
        link_to("Patient Dashboard", dashboard_path)
      ),
      class: "breadcrumb"
    )
  )
end