Class: Renalware::Surveys::POSSSummaryPart
Constant Summary
Renalware::SummaryPart::DATE_FORMAT
Instance Method Summary
collapse
#cache?, #cache_key, #render?
Instance Method Details
#column_headings ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'app/models/renalware/surveys/pos_s_summary_part.rb', line 31
def column_headings
@column_headings ||= begin
headings = ["Date"]
headings.concat(
Renalware::Survey
.find_by!(code: "prom")
.questions
.order(:position)
.pluck(:label)
)
headings
end
end
|
#data_for_question_code(_code) ⇒ Object
24
25
26
27
28
29
|
# File 'app/models/renalware/surveys/pos_s_summary_part.rb', line 24
def data_for_question_code(_code)
Renalware::Surveys::Response
.where(patient_id: patient.id, question_id: 1)
.pluck(:answered_on, :value)
.to_h
end
|
#question_labels ⇒ Object
13
14
15
16
17
18
19
20
21
|
# File 'app/models/renalware/surveys/pos_s_summary_part.rb', line 13
def question_labels
@question_labels ||= begin
survey
.questions
.order(:position)
.select(:code, :label)
.each_with_object({}) { |q, hash| hash[q.code] = q.label }
end
end
|
#rows ⇒ Object
9
10
11
|
# File 'app/models/renalware/surveys/pos_s_summary_part.rb', line 9
def rows
@rows ||= POSSPivotedResponse.where(patient_id: patient.id)
end
|
#survey ⇒ Object
50
51
52
|
# File 'app/models/renalware/surveys/pos_s_summary_part.rb', line 50
def survey
@survey ||= Renalware::Surveys::Survey.find_by!(code: "prom")
end
|
#to_partial_path ⇒ Object
46
47
48
|
# File 'app/models/renalware/surveys/pos_s_summary_part.rb', line 46
def to_partial_path
"renalware/surveys/pos_s_summary_part"
end
|