missinglink 0.2.1.1 → 0.2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90a8c402694e1bcfd9e36658ed6919150b546aba
4
- data.tar.gz: 81f1d658a20f25baa96278ffe605837d93fb6512
3
+ metadata.gz: ea56f8bc82557af923f9a4f3ff993bbce09b2f69
4
+ data.tar.gz: 4510b326f1b30a03adca6617cbe0abb26a8da75c
5
5
  SHA512:
6
- metadata.gz: 6b4a3785a7a47173db80fabe9088f3aea5f68d3c5978a4d60b7637deb2900e23432ba599a6aae88bba76b90aa4202034636c6c77e3845be3a11dc16a5e3db14f
7
- data.tar.gz: 78315db99f9fddbe128383343678d7aca667eeeab135e2331056b3278f7b451f2f166db4ad3e67a37c8218f508b94c7eea0bcf95641029537b1c70806bf28772
6
+ metadata.gz: d694d0fe846b86155700298f4277981f24bd54c2700fa63e89f2b8e24db98e3df408736bb2e69b5b70dcb2e0f699884680413ec97a47202ad06050b77a7efdd8
7
+ data.tar.gz: 45c2f372d424be4660a441c54faf5415ff0a6ed77f1131954f3dd8f2eff6689a4aef2cabec9b0973be760387d2cd1e84c1886e8c55e77743cc867d9dce23bb29
@@ -91,7 +91,6 @@ module Missinglink
91
91
  end
92
92
  end
93
93
 
94
- private
95
94
  def answer_strategy
96
95
  Missinglink.answer_strategies[type_family][type_subtype]
97
96
  end
@@ -26,6 +26,43 @@ module Missinglink
26
26
  end
27
27
  end
28
28
 
29
+ def response_to_question(question)
30
+ return nil unless response = survey_responses.find_by_survey_question_id(question.id)
31
+ response_texts = []
32
+
33
+ case question.answer_strategy
34
+ when "first_survey_response_answer_text"
35
+ return response.survey_response_answers.first.text
36
+ when "answer_row_match_for_survey_response_answer_text"
37
+ response.survey_response_answers.each do |sra|
38
+ if sra.text.nil?
39
+ response_texts << SurveyAnswer.find(sra.row_survey_answer_id).text
40
+ else
41
+ response_texts << (SurveyAnswer.find(sra.row_survey_answer_id).text + ": " + sra.text)
42
+ end
43
+ end
44
+ when "row_column_survey_response_answers_and_text"
45
+ response.survey_response_answers.each do |sra|
46
+ if sra.text.nil?
47
+ response_texts << (SurveyAnswer.find(sra.row_survey_answer_id).text + ": " + SurveyAnswer.find(sra.col_survey_answer_id).text)
48
+ else
49
+ response_texts << "Other: #{ sra.text }"
50
+ end
51
+ end
52
+ when "row_column_and_choice_survey_response_answers_and_text"
53
+ response.survey_response_answers.each do |sra|
54
+ if sra.text.nil?
55
+ response_texts << (SurveyAnswer.find(sra.row_survey_answer_id).text + ", " +
56
+ SurveyAnswer.find(sra.col_survey_answer_id).text + ": " +
57
+ SurveyAnswer.find(sra.col_choice_survey_answer_id).text)
58
+ else
59
+ response_texts << "Other: #{ sra.text }"
60
+ end
61
+ end
62
+ end
63
+ return response_texts.join("; ")
64
+ end
65
+
29
66
  private
30
67
  def self.prepare_respondent_details(respondent_hash)
31
68
  hash = { collection_mode: respondent_hash['collection_mode'],
@@ -1,3 +1,3 @@
1
1
  module Missinglink
2
- VERSION = "0.2.1.1"
2
+ VERSION = "0.2.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: missinglink
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1.1
4
+ version: 0.2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trey Springer