From 4be6dc74f963b384b0ebf8add85d9762eb1dec68 Mon Sep 17 00:00:00 2001 From: Bohung Date: Mon, 8 Nov 2021 19:36:29 +0800 Subject: [PATCH] Fix bug. --- app/models/questionnaire_survey.rb | 1 + app/views/admin/surveys/_index.html.erb | 2 +- app/views/admin/surveys/answer_sets.html.erb | 2 +- app/views/survey_export/export.xlsx.axlsx | 4 ++-- app/views/surveys/my_record.html.erb | 4 ++-- config/locales/en.yml | 3 +++ config/locales/zh_tw.yml | 3 +++ 7 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/models/questionnaire_survey.rb b/app/models/questionnaire_survey.rb index 5ae7dc2..6a658d6 100644 --- a/app/models/questionnaire_survey.rb +++ b/app/models/questionnaire_survey.rb @@ -120,6 +120,7 @@ class QuestionnaireSurvey answers =(0...survey_answers.count).map{{}} survey_answers.each_with_index do |answer,i| answers[i]["name"] = User.find(answer.user).member_name rescue "" + answers[i]["agree"] = I18n.t("survey.#{answer.consent_used}") end SurveysHelper.set_locale(I18n.locale) survey_questions.each do |question| diff --git a/app/views/admin/surveys/_index.html.erb b/app/views/admin/surveys/_index.html.erb index 7137f16..d561861 100644 --- a/app/views/admin/surveys/_index.html.erb +++ b/app/views/admin/surveys/_index.html.erb @@ -30,7 +30,7 @@
  • <%= t('survey.duplicate_it') %>
  • <%= t('survey.jump') %>
  • <%= t('survey.set_answers') %>
  • -
  • <%= t('survey.export_csv') %>
  • +
  • <%= t('survey.export_xls') %>
  • <%= t('survey.set_sections') %>
  • <%= t('survey.chart') %>
  • <%= t(:delete_) %>
  • diff --git a/app/views/admin/surveys/answer_sets.html.erb b/app/views/admin/surveys/answer_sets.html.erb index a4fa74e..11cf521 100644 --- a/app/views/admin/surveys/answer_sets.html.erb +++ b/app/views/admin/surveys/answer_sets.html.erb @@ -137,7 +137,7 @@ is_sort: true }, points: { - radius: 3, + radius: 5, show: true }, downsample: { diff --git a/app/views/survey_export/export.xlsx.axlsx b/app/views/survey_export/export.xlsx.axlsx index 75a4919..b89ded6 100644 --- a/app/views/survey_export/export.xlsx.axlsx +++ b/app/views/survey_export/export.xlsx.axlsx @@ -4,8 +4,8 @@ wb = xlsx_package.workbook title = survey.title title = "WorkSheet1" if title.blank? wb.add_worksheet(name: title) do |sheet| - row = [I18n.t("survey.taken_by")] - row2 = [""] + row = [I18n.t("survey.taken_by"), I18n.t("survey.consent_to_be_used_for_research")] + row2 = ["", ""] survey_questions.each_with_index do |question, i| qnum = question.title.match(/^\d+./).nil? ? "#{i+1}. " : "" start_col = row2.count diff --git a/app/views/surveys/my_record.html.erb b/app/views/surveys/my_record.html.erb index 6fb5cec..6e40523 100644 --- a/app/views/surveys/my_record.html.erb +++ b/app/views/surveys/my_record.html.erb @@ -120,8 +120,8 @@ is_sort: true }, points: { - radius: 3, - show: false + radius: 5, + show: true }, downsample: { threshold: 0 diff --git a/config/locales/en.yml b/config/locales/en.yml index b8f3391..83d6158 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2,6 +2,8 @@ en: module_name: survey: Survey survey: + 'true': 'Yes' + 'false': 'No' consent_to_be_used_for_research: "Consent answer to be used for research" agree: Agree consent_contents: '"Consent" contents' @@ -55,6 +57,7 @@ en: answer_error: Unsuccessful answer answers_list: Answers List + export_xls: Export Excel export_csv: Export CSV chart: Chart set_answers: Set Answers diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 5a74f2e..0daf01f 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -4,6 +4,8 @@ zh_tw: survey: 問卷調查 survey: + 'true': 是 + 'false': 否 consent_to_be_used_for_research: "同意填答結果被用於研究" agree: 同意 consent_contents: '"同意書"內容' @@ -62,6 +64,7 @@ zh_tw: answer_error: 問卷填寫錯誤 answers_list: 結果清單 + export_xls: 匯出Excel export_csv: 匯出CSV chart: 結果圖表 set_answers: 設定結果