missinglink 0.2.1.2 → 0.2.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 031940a4f497ae75cadfe5db7bd0b0b6c65ce1da
|
4
|
+
data.tar.gz: 6dc99bee3508e41897e124ec4bb7e38249eb0b23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0eb64818491642d6b086f1a8f7439464708226a409b5f23e7dfd6bc3b5b437d7df0e56528b4cb45a30203446ad8640c8ac50384905cb1fa1a11761de6bc1c68
|
7
|
+
data.tar.gz: 1eea5649a3fc6721bc63b1a69ad529c757a6e58e57878e5fbb09edd3902acde5e29a665e92ab624aed20e1ed2f13ebf077749f02ab6df70d8d380d99463277b5
|
@@ -34,5 +34,20 @@ module Missinglink
|
|
34
34
|
return SurveyAnswer.create(survey_question_id: question_id, sm_answer_id: sm_id.to_i)
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
def possible_responses
|
39
|
+
strategy = survey_question.answer_strategy
|
40
|
+
filtered = survey_question.possible_responses.select do |k,v|
|
41
|
+
sra = SurveyResponseAnswer.find(v)
|
42
|
+
if strategy == "answer_row_and_column_for_response" ||
|
43
|
+
strategy == "answer_row_for_subquestion" ||
|
44
|
+
strategy == "answer_row_column_choice_for_response"
|
45
|
+
(sra.row_survey_answer_id == self.id)
|
46
|
+
else
|
47
|
+
true
|
48
|
+
end
|
49
|
+
end
|
50
|
+
return filtered
|
51
|
+
end
|
37
52
|
end
|
38
53
|
end
|
@@ -48,16 +48,20 @@ module Missinglink
|
|
48
48
|
case answer_strategy
|
49
49
|
when "first_survey_response_answer_text"
|
50
50
|
hash[sra.text] = sra.id unless (sra.text.nil? || hash[sra.text])
|
51
|
-
when "
|
51
|
+
when "answer_row_for_subquestion"
|
52
52
|
other_text = ((!search_other || sra.text.nil?) ? nil : "#{ (sa_row.try(:text) || "Other") }: #{ sra.text }")
|
53
53
|
hash[sa_row.text] = sra.id unless (sa_row.nil? || hash[sa_row.text])
|
54
54
|
hash[other_text] = sra.id unless (other_text.nil? || hash[other_text])
|
55
|
-
when "
|
55
|
+
when "answer_row_for_response"
|
56
|
+
other_text = ((!search_other || sra.text.nil?) ? nil : "#{ (sa_row.try(:text) || "Other") }: #{ sra.text }")
|
57
|
+
hash[sa_row.text] = sra.id unless (sa_row.nil? || hash[sa_row.text])
|
58
|
+
hash[other_text] = sra.id unless (other_text.nil? || hash[other_text])
|
59
|
+
when "answer_row_and_column_for_response"
|
56
60
|
main_text = "#{ sa_row.try(:text) }: #{ sa_col.try(:text) }"
|
57
61
|
other_text = ((!search_other || sra.text.nil? || !sa_row.nil?) ? nil : "Other: #{ sra.text }")
|
58
62
|
hash[main_text] = sra.id unless (sa_row.nil? || sa_col.nil? || hash[main_text])
|
59
63
|
hash[other_text] = sra.id unless (other_text.nil? || hash[other_text])
|
60
|
-
when "
|
64
|
+
when "answer_row_column_choice_for_response"
|
61
65
|
main_text = "#{ sa_row.try(:text) }, #{ sa_col.try(:text) }: #{ sa_col_choice.try(:text) }"
|
62
66
|
other_text = ((!search_other || sra.text.nil? || !sa_row.nil?) ? nil : "Other: #{ sra.text }")
|
63
67
|
hash[main_text] = sra.id unless (sa_row.nil? || sa_col.nil? || sa_col_choice.nil? || hash[main_text])
|
@@ -73,16 +77,21 @@ module Missinglink
|
|
73
77
|
end
|
74
78
|
|
75
79
|
case answer_strategy
|
76
|
-
when "
|
80
|
+
when "answer_row_for_subquestion"
|
81
|
+
survey_response_answers.select do |sra|
|
82
|
+
sra.row_survey_answer_id == response_answer.row_survey_answer_id &&
|
83
|
+
sra.text == response_answer.text
|
84
|
+
end.sort
|
85
|
+
when "answer_row_for_response"
|
77
86
|
survey_response_answers.select do |sra|
|
78
87
|
sra.row_survey_answer_id == response_answer.row_survey_answer_id
|
79
88
|
end.sort
|
80
|
-
when "
|
89
|
+
when "answer_row_and_column_for_response"
|
81
90
|
survey_response_answers.select do |sra|
|
82
91
|
sra.row_survey_answer_id == response_answer.row_survey_answer_id &&
|
83
92
|
sra.col_survey_answer_id == response_answer.col_survey_answer_id
|
84
93
|
end.sort
|
85
|
-
when "
|
94
|
+
when "answer_row_column_choice_for_response"
|
86
95
|
survey_response_answers.select do |sra|
|
87
96
|
sra.row_survey_answer_id == response_answer.row_survey_answer_id &&
|
88
97
|
sra.col_survey_answer_id == response_answer.col_survey_answer_id &&
|
@@ -91,6 +100,22 @@ module Missinglink
|
|
91
100
|
end
|
92
101
|
end
|
93
102
|
|
103
|
+
def question_parts
|
104
|
+
return nil if survey_response_answers.empty?
|
105
|
+
if answer_strategy == "answer_row_for_subquestion" ||
|
106
|
+
answer_strategy == "answer_row_and_column_for_response" ||
|
107
|
+
answer_strategy == "answer_row_column_choice_for_response"
|
108
|
+
return {}.tap do |hash|
|
109
|
+
survey_response_answers.each do |sra|
|
110
|
+
sa_row = (sra.row_survey_answer_id ? SurveyAnswer.find(sra.row_survey_answer_id) : nil)
|
111
|
+
hash[sa_row.text] = sra.row_survey_answer_id unless (sa_row.nil? || hash[sa_row.text])
|
112
|
+
end
|
113
|
+
end
|
114
|
+
else
|
115
|
+
return nil
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
94
119
|
def answer_strategy
|
95
120
|
Missinglink.answer_strategies[type_family][type_subtype]
|
96
121
|
end
|
@@ -33,7 +33,7 @@ module Missinglink
|
|
33
33
|
case question.answer_strategy
|
34
34
|
when "first_survey_response_answer_text"
|
35
35
|
return response.survey_response_answers.first.text
|
36
|
-
when "
|
36
|
+
when "answer_row_for_response"
|
37
37
|
response.survey_response_answers.each do |sra|
|
38
38
|
if sra.text.nil?
|
39
39
|
response_texts << SurveyAnswer.find(sra.row_survey_answer_id).text
|
@@ -41,7 +41,7 @@ module Missinglink
|
|
41
41
|
response_texts << (SurveyAnswer.find(sra.row_survey_answer_id).text + ": " + sra.text)
|
42
42
|
end
|
43
43
|
end
|
44
|
-
when "
|
44
|
+
when "answer_row_and_column_for_response"
|
45
45
|
response.survey_response_answers.each do |sra|
|
46
46
|
if sra.text.nil?
|
47
47
|
response_texts << (SurveyAnswer.find(sra.row_survey_answer_id).text + ": " + SurveyAnswer.find(sra.col_survey_answer_id).text)
|
@@ -49,7 +49,7 @@ module Missinglink
|
|
49
49
|
response_texts << "Other: #{ sra.text }"
|
50
50
|
end
|
51
51
|
end
|
52
|
-
when "
|
52
|
+
when "answer_row_column_choice_for_response"
|
53
53
|
response.survey_response_answers.each do |sra|
|
54
54
|
if sra.text.nil?
|
55
55
|
response_texts << (SurveyAnswer.find(sra.row_survey_answer_id).text + ", " +
|
data/etc/question_types.yml
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
# first_survey_response_answer_text:
|
2
2
|
# pull the first SRA, and use the text
|
3
|
-
#
|
3
|
+
# answer_row_for_subquestion
|
4
|
+
# for each SRA, the row answer specifies what the text is answering
|
5
|
+
# answer_row_for_response:
|
4
6
|
# pull each SRA, use the row answer, and the text if present
|
5
|
-
#
|
7
|
+
# answer_row_and_column_for_response
|
6
8
|
# pull each SRA, combo row/column search, "other" just has text
|
7
|
-
#
|
9
|
+
# answer_row_column_choice_for_response:
|
8
10
|
# pull each SRA, combo row/column/colchoice search, "other" text
|
9
11
|
# none:
|
10
12
|
# this is not actually a question, so ignore it
|
@@ -12,33 +14,33 @@
|
|
12
14
|
|
13
15
|
open_ended:
|
14
16
|
essay: first_survey_response_answer_text
|
15
|
-
multi:
|
16
|
-
numerical:
|
17
|
+
multi: answer_row_for_subquestion
|
18
|
+
numerical: answer_row_for_subquestion
|
17
19
|
single: first_survey_response_answer_text
|
18
20
|
single_choice:
|
19
|
-
vertical:
|
20
|
-
vertical_two_col:
|
21
|
-
vertical_three_col:
|
22
|
-
horiz:
|
23
|
-
menu:
|
21
|
+
vertical: answer_row_for_response
|
22
|
+
vertical_two_col: answer_row_for_response
|
23
|
+
vertical_three_col: answer_row_for_response
|
24
|
+
horiz: answer_row_for_response
|
25
|
+
menu: answer_row_for_response
|
24
26
|
multiple_choice:
|
25
|
-
vertical:
|
26
|
-
vertical_two_col:
|
27
|
-
vertical_three_col:
|
28
|
-
horiz:
|
27
|
+
vertical: answer_row_for_response
|
28
|
+
vertical_two_col: answer_row_for_response
|
29
|
+
vertical_three_col: answer_row_for_response
|
30
|
+
horiz: answer_row_for_response
|
29
31
|
matrix:
|
30
|
-
single:
|
31
|
-
multi:
|
32
|
-
menu:
|
33
|
-
rating:
|
34
|
-
ranking:
|
32
|
+
single: answer_row_and_column_for_response
|
33
|
+
multi: answer_row_and_column_for_response
|
34
|
+
menu: answer_row_column_choice_for_response
|
35
|
+
rating: answer_row_and_column_for_response
|
36
|
+
ranking: answer_row_and_column_for_response
|
35
37
|
demographic:
|
36
|
-
us:
|
37
|
-
international:
|
38
|
+
us: answer_row_for_subquestion
|
39
|
+
international: answer_row_for_subquestion
|
38
40
|
datetime:
|
39
|
-
date_only:
|
40
|
-
time_only:
|
41
|
-
both:
|
41
|
+
date_only: answer_row_for_response
|
42
|
+
time_only: answer_row_for_response
|
43
|
+
both: answer_row_for_response
|
42
44
|
presentation:
|
43
45
|
image: none
|
44
46
|
video: none
|
data/lib/missinglink/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: missinglink
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trey Springer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|