104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
# File 'lib/surveyor/redcap_parser.rb', line 104
def build_and_set(context, r)
if !r[:section_header].blank?
context[:survey_section].questions.build({:display_type => "label", :text => r[:section_header], :display_order => context[:survey_section].questions.size})
Surveyor::RedcapParser.rake_trace "label_ "
end
self.attributes = ({
:reference_identifier => r[:variable__field_name],
:text => r[:field_label],
:help_text => r[:field_note],
:is_mandatory => (/^y/i.match r[:required_field]) ? true : false,
:pick => pick_from_field_type(r[:field_type]),
:display_type => display_type_from_field_type(r[:field_type]),
:display_order => context[:survey_section].questions.size
})
context[:survey_section].questions << context[:question] = self
unless context[:question].reference_identifier.blank?
context[:question_references] ||= {}
context[:question_references][context[:question].reference_identifier] = context[:question]
end
Surveyor::RedcapParser.rake_trace "question_#{context[:question].reference_identifier} "
end
|