From 232328a7f870e3ea11c4346ebefdde25b47b099a Mon Sep 17 00:00:00 2001 From: Bernie Chiu Date: Fri, 25 Oct 2013 17:03:53 +0800 Subject: [PATCH] Add oneline and multiline import --- .../panel/survey/back_end/surveys_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vendor/built_in_modules/survey/app/controllers/panel/survey/back_end/surveys_controller.rb b/vendor/built_in_modules/survey/app/controllers/panel/survey/back_end/surveys_controller.rb index c669d0bfa..8e156bb5d 100644 --- a/vendor/built_in_modules/survey/app/controllers/panel/survey/back_end/surveys_controller.rb +++ b/vendor/built_in_modules/survey/app/controllers/panel/survey/back_end/surveys_controller.rb @@ -137,6 +137,9 @@ class Panel::Survey::BackEnd::SurveysController < OrbitBackendController @survey_questions.each_with_index do |question, index| case question.type + when ::SurveyQuestion::Oneline, ::SurveyQuestion::Multiline + @answer_model[question.id.to_s] = @spreadsheet.row(row)[index * 2] + when ::SurveyQuestion::Radio, ::SurveyQuestion::Select if !@spreadsheet.row(row)[index*2].nil? && @spreadsheet.row(row)[index*2] != " " @answer_model[question.id.to_s] = @spreadsheet.row(row)[index*2] @@ -159,11 +162,8 @@ class Panel::Survey::BackEnd::SurveysController < OrbitBackendController # Grab answers info answers = [] - (spreadsheet_radiogroups_lines..@spreadsheet.last_row).each do |line| - - if not @spreadsheet.row(line)[index * 2].blank? - answers << eval(@spreadsheet.row(line)[index * 2]) - end + if not @spreadsheet.row(row)[index * 2].blank? + answers << eval(@spreadsheet.row(row)[index * 2]) end # Save the answers