Class: Renalware::UKRDC::Incoming::ImportSurvey

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/ukrdc/incoming/import_survey.rb

Instance Method Summary collapse

Instance Method Details

#callObject

Note that each question’s answer may be a value like “1” or be an array where the second element is the user-entered question text e.g. [“1”, “Paranoia”] This is used in POS-S so that a user can enter their own question text.



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/models/renalware/ukrdc/incoming/import_survey.rb', line 15

def call
  responses.each do |question_code, answer|
    question = question_having_code(question_code)
    answer = Array(answer)
    Surveys::Response.create!(
      patient_id: patient.id,
      question: question,
      value: answer[0],
      patient_question_text: answer[1],
      answered_on: answered_on
    )
  end
end