This commit is contained in:
BoHung Chiu 2021-09-12 21:04:38 +08:00
parent 42569fd0b7
commit 9eb64bb6a5
1 changed files with 1 additions and 2 deletions

View File

@ -6,7 +6,6 @@ Rails.application.routes.draw do
surveys.each do |survey|
group_data = survey.survey_answers.asc(:updated_at).group_by(&:user)
group_data.each do |user_id,survey_answers|
org_updated_at = survey_answers.map{|a| a.updated_at}
if user_id.blank?
survey_answers.each do |survey_answer|
info = {:questionnaire_survey_id=>survey.id,:user=>user_id,:survey_answer_ids=>[survey_answer.id]}
@ -29,7 +28,7 @@ Rails.application.routes.draw do
answer_group.survey_answer_ids = survey_answers.map{|a| a.id}
answer_group.save
end
survey_answers.each_with_index{|a,i| a.updated_at = org_updated_at[i];a.save}
survey_answers.each_with_index{|a,i| a.updated_at = a.created_at;a.save}
end
survey.already_fix_data = true
survey.survey_questions.each do |q|