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 =
[
  "participant_activities_visualizations",
  "participant_thoughts_visualizations"
]

Instance Method Summary collapse

Instance Method Details

#activities_planned_7_day(participant) ⇒ Object



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

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



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

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

#activities_planned_total(participant) ⇒ Object



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

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


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

def breadcrumbs
  return unless VISUALIZATION_CONTROLLERS.include?(controller_name)

  dashboard_path = coach_group_patient_dashboard_path(
    @participant.active_group,
    @participant
  )

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