Module: ThinkFeelDoEngine::Coach::DashboardAndPhqTableHelper

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

Overview

Provides helpers for patient dashboard index and phq9 table

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nil_stayObject

Returns the value of attribute nil_stay.



6
7
8
# File 'app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb', line 6

def nil_stay
  @nil_stay
end

#nil_stepObject

Returns the value of attribute nil_step.



6
7
8
# File 'app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb', line 6

def nil_step
  @nil_step
end

#release_labelObject

Returns the value of attribute release_label.



6
7
8
# File 'app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb', line 6

def release_label
  @release_label
end

#release_stringObject

Returns the value of attribute release_string.



6
7
8
# File 'app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb', line 6

def release_string
  @release_string
end

#stay_labelObject

Returns the value of attribute stay_label.



6
7
8
# File 'app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb', line 6

def stay_label
  @stay_label
end

#stay_stringObject

Returns the value of attribute stay_string.



6
7
8
# File 'app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb', line 6

def stay_string
  @stay_string
end

#step_labelObject

Returns the value of attribute step_label.



6
7
8
# File 'app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb', line 6

def step_label
  @step_label
end

#step_or_nil_resultsObject

Returns the value of attribute step_or_nil_results.



6
7
8
# File 'app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb', line 6

def step_or_nil_results
  @step_or_nil_results
end

#step_stringObject

Returns the value of attribute step_string.



6
7
8
# File 'app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb', line 6

def step_string
  @step_string
end

#test_summaryObject

Returns the value of attribute test_summary.



6
7
8
# File 'app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb', line 6

def test_summary
  @test_summary
end

Instance Method Details

#edge_week?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb', line 25

def edge_week?
  @test_summary[:current_week] == @test_summary[:range_start]
end

#init_summary_styles(test_summary) ⇒ Object



11
12
13
14
15
16
17
18
# File 'app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb', line 11

def init_summary_styles(test_summary)
  @nil_step = test_summary[:step?].nil?
  @nil_stay = test_summary[:stay?].nil?
  @step_or_nil_results = @nil_step || test_summary[:step?]
  define_strings(test_summary)
  define_labels(test_summary)
  @test_summary = test_summary
end

#result_span(text, label) ⇒ Object



20
21
22
23
# File 'app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb', line 20

def result_span(text, label)
  (:span, text.to_s, class: "label label-" +
    label.to_s).html_safe
end

#study_length_in_weeksObject



33
34
35
# File 'app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb', line 33

def study_length_in_weeks
  Rails.application.config.study_length_in_weeks
end

#view_membership(participant, group) ⇒ Object



29
30
31
# File 'app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb', line 29

def view_membership(participant, group)
  Membership.find_by(participant: participant, group: group)
end