diff --git a/app/models/questionnaire_survey.rb b/app/models/questionnaire_survey.rb index 7f0ccf5..e2c0024 100644 --- a/app/models/questionnaire_survey.rb +++ b/app/models/questionnaire_survey.rb @@ -185,9 +185,14 @@ class QuestionnaireSurvey survey_answers = survey_answers.to_a chart_data = {} answers =(0...survey_answers.count).map{{}} + agree_trans = I18n.t("survey.true") + disagree_trans = I18n.t("survey.false") survey_answers.each_with_index do |answer,i| answers[i]["name"] = User.find(answer.user).member_name rescue "" - answers[i]["agree"] = I18n.t("self.#{answer.consent_used}") + answers[i]["time"] = answer.created_at.strftime((I18n.locale == :zh_tw ? "%Y/%m/%d %H:%M" : "%h %d, %Y - %H:%M")) + if self.enable_consent_feature + answers[i]["agree"] = (answer.consent_used ? agree_trans : disagree_trans) + end end SurveysHelper.set_locale(I18n.locale) survey_questions.each do |question| diff --git a/app/models/survey_answer.rb b/app/models/survey_answer.rb index 25b7f6e..329e137 100644 --- a/app/models/survey_answer.rb +++ b/app/models/survey_answer.rb @@ -21,7 +21,7 @@ class SurveyAnswer if answer_group.nil? answer_group = SurveyAnswerGroup.new(info) end - answer_group.last_modified = self.updated_at + answer_group.last_modified = self.created_at answer_group.survey_answer_ids << self.id answer_group.save end @@ -29,7 +29,7 @@ class SurveyAnswer after_save do answer_group = SurveyAnswerGroup.where(:questionnaire_survey_id=>self.questionnaire_survey.id,:user=>user).first if answer_group - answer_group.last_modified = self.updated_at + answer_group.last_modified = self.created_at answer_group.save end end diff --git a/app/views/admin/surveys/answer_sets.html.erb b/app/views/admin/surveys/answer_sets.html.erb index 19a57b6..f34dd20 100644 --- a/app/views/admin/surveys/answer_sets.html.erb +++ b/app/views/admin/surveys/answer_sets.html.erb @@ -54,6 +54,7 @@ <% end %> <% if type == "result_chart" %> +<% @survey_answers.options = {} %>