merge
This commit is contained in:
parent
d3fc6e5956
commit
4a897b68cf
|
@ -109,10 +109,30 @@ class Panel::Survey::BackEnd::SurveysController < OrbitBackendController
|
||||||
question.update_attributes(title: titles[index])
|
question.update_attributes(title: titles[index])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@survey.survey_answers.destroy
|
||||||
|
|
||||||
# Modify multiline options if changed
|
# Modify multiline options if changed
|
||||||
@survey_questions.each_with_index do |question, index|
|
@survey_questions.each_with_index do |question, index|
|
||||||
|
|
||||||
case question.type
|
case question.type
|
||||||
|
|
||||||
|
when ::SurveyQuestion::Radio, ::SurveyQuestion::Select
|
||||||
|
(2..(question.survey_question_options.count + 1)).each do |row|
|
||||||
|
(1..@spreadsheet.row(row)[index*2 + 1].to_i).each do
|
||||||
|
@answer_model = @survey.survey_answers.new
|
||||||
|
@answer_model[question.id.to_s] = @spreadsheet.row(row)[index*2]
|
||||||
|
@answer_model.save!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
when ::SurveyQuestion::Check
|
||||||
|
(2..(question.survey_question_options.count + 1)).each do |row|
|
||||||
|
(1..@spreadsheet.row(row)[index*2 + 1].to_i).each do
|
||||||
|
@answer_model = @survey.survey_answers.new
|
||||||
|
@answer_model[question.id.to_s] = [ @spreadsheet.row(row)[index*2] ]
|
||||||
|
@answer_model.save!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
when ::SurveyQuestion::Radiogroup
|
when ::SurveyQuestion::Radiogroup
|
||||||
radio_groups = []
|
radio_groups = []
|
||||||
spreadsheet_radiogroups_lines =
|
spreadsheet_radiogroups_lines =
|
||||||
|
|
Loading…
Reference in New Issue