Fix duplicate options
This commit is contained in:
parent
77c00ac72f
commit
d19223c873
|
@ -199,6 +199,7 @@ class Panel::Survey::BackEnd::SurveysController < OrbitBackendController
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
@survey.survey_questions.all.each do |question|
|
||||
new_question = @new_survey.survey_questions.new
|
||||
question.attributes.each do |key, value|
|
||||
|
@ -210,30 +211,32 @@ class Panel::Survey::BackEnd::SurveysController < OrbitBackendController
|
|||
end
|
||||
end
|
||||
end
|
||||
question.survey_question_options.all.each do |option|
|
||||
new_option = new_question.survey_question_options.new
|
||||
option.attributes.each do |key, value|
|
||||
unless ['_id', 'survey_question_id'].include? key
|
||||
if option.respond_to?(key + '_translations')
|
||||
new_option.send(key + '_translations=', value)
|
||||
else
|
||||
new_option.write_attribute(key, value)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
question.survey_question_radiogroups.all.each do |radiogroup|
|
||||
new_radiogroup = new_question.survey_question_radiogroups.new
|
||||
radiogroup.attributes.each do |key, value|
|
||||
unless ['_id', 'survey_question_id'].include? key
|
||||
if radiogroup.respond_to?(key + '_translations')
|
||||
new_radiogroup.send(key + '_translations=', value)
|
||||
else
|
||||
new_radiogroup.write_attribute(key, value)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# question.survey_question_options.all.each do |option|
|
||||
# new_option = new_question.survey_question_options.new
|
||||
# option.attributes.each do |key, value|
|
||||
# unless ['_id', 'survey_question_id'].include? key
|
||||
# if option.respond_to?(key + '_translations')
|
||||
# new_option.name_translations = value
|
||||
# else
|
||||
# new_option.write_attribute(key, value)
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
# question.survey_question_radiogroups.all.each do |radiogroup|
|
||||
# new_radiogroup = new_question.survey_question_radiogroups.new
|
||||
# radiogroup.attributes.each do |key, value|
|
||||
# unless ['_id', 'survey_question_id'].include? key
|
||||
# if radiogroup.respond_to?(key + '_translations')
|
||||
# new_option.name_translations = value
|
||||
# else
|
||||
# new_radiogroup.write_attribute(key, value)
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
@new_survey.create_user_id = current_user.id
|
||||
|
|
Reference in New Issue