Add oneline and multiline import
This commit is contained in:
parent
4a736cc92c
commit
67cd34ab27
|
@ -135,6 +135,9 @@ class Panel::Survey::BackEnd::SurveysController < OrbitBackendController
|
||||||
@survey_questions.each_with_index do |question, index|
|
@survey_questions.each_with_index do |question, index|
|
||||||
case question.type
|
case question.type
|
||||||
|
|
||||||
|
when ::SurveyQuestion::Oneline, ::SurveyQuestion::Multiline
|
||||||
|
@answer_model[question.id.to_s] = @spreadsheet.row(row)[index * 2]
|
||||||
|
|
||||||
when ::SurveyQuestion::Radio, ::SurveyQuestion::Select
|
when ::SurveyQuestion::Radio, ::SurveyQuestion::Select
|
||||||
if !@spreadsheet.row(row)[index*2].nil? && @spreadsheet.row(row)[index*2] != " "
|
if !@spreadsheet.row(row)[index*2].nil? && @spreadsheet.row(row)[index*2] != " "
|
||||||
@answer_model[question.id.to_s] = @spreadsheet.row(row)[index*2]
|
@answer_model[question.id.to_s] = @spreadsheet.row(row)[index*2]
|
||||||
|
@ -157,11 +160,8 @@ class Panel::Survey::BackEnd::SurveysController < OrbitBackendController
|
||||||
|
|
||||||
# Grab answers info
|
# Grab answers info
|
||||||
answers = []
|
answers = []
|
||||||
(spreadsheet_radiogroups_lines..@spreadsheet.last_row).each do |line|
|
if not @spreadsheet.row(row)[index * 2].blank?
|
||||||
|
answers << eval(@spreadsheet.row(row)[index * 2])
|
||||||
if not @spreadsheet.row(line)[index * 2].blank?
|
|
||||||
answers << eval(@spreadsheet.row(line)[index * 2])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Save the answers
|
# Save the answers
|
||||||
|
|
Loading…
Reference in New Issue