fix import-csv column error
This commit is contained in:
parent
f3f4dc842c
commit
1266cd1384
|
@ -109,13 +109,13 @@ class Panel::Survey::BackEnd::SurveysController < OrbitBackendController
|
|||
# end
|
||||
|
||||
@survey.survey_answers.destroy
|
||||
@survey_questions.each do |question|
|
||||
@survey_questions.each_with_index do |question,column|
|
||||
case question.type
|
||||
when ::SurveyQuestion::Radio, ::SurveyQuestion::Select
|
||||
(@current_row..(@current_row + question.survey_question_options.count - 1)).each do |i|
|
||||
(1..@spreadsheet.row(i)[1].to_i).each do
|
||||
(@current_row..(@current_row + question.survey_question_options.count - 1)).each do |row|
|
||||
(1..@spreadsheet.row(row)[column + 1].to_i).each do
|
||||
@answer_model = @survey.survey_answers.new
|
||||
@answer_model[question.id.to_s] = @spreadsheet.row(i)[0]
|
||||
@answer_model[question.id.to_s] = @spreadsheet.row(row)[column]
|
||||
@answer_model.save!
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue