This commit is contained in:
BoHung Chiu 2021-11-08 19:36:29 +08:00
parent 783e919dae
commit 4be6dc74f9
7 changed files with 13 additions and 6 deletions

View File

@ -120,6 +120,7 @@ class QuestionnaireSurvey
answers =(0...survey_answers.count).map{{}} answers =(0...survey_answers.count).map{{}}
survey_answers.each_with_index do |answer,i| survey_answers.each_with_index do |answer,i|
answers[i]["name"] = User.find(answer.user).member_name rescue "" answers[i]["name"] = User.find(answer.user).member_name rescue ""
answers[i]["agree"] = I18n.t("survey.#{answer.consent_used}")
end end
SurveysHelper.set_locale(I18n.locale) SurveysHelper.set_locale(I18n.locale)
survey_questions.each do |question| survey_questions.each do |question|

View File

@ -30,7 +30,7 @@
<li><a href="/admin/surveys/<%=survey.id.to_s%>/duplicate_it"><%= t('survey.duplicate_it') %></a></li> <li><a href="/admin/surveys/<%=survey.id.to_s%>/duplicate_it"><%= t('survey.duplicate_it') %></a></li>
<li><a href="/admin/surveys/<%=survey.id.to_s%>/jump"><%= t('survey.jump') %></a></li> <li><a href="/admin/surveys/<%=survey.id.to_s%>/jump"><%= t('survey.jump') %></a></li>
<li><a href="/admin/surveys/<%=survey.id.to_s%>/set_answers"><%= t('survey.set_answers') %></a></li> <li><a href="/admin/surveys/<%=survey.id.to_s%>/set_answers"><%= t('survey.set_answers') %></a></li>
<li><a href="/admin/surveys/<%=survey.id.to_s%>/export?format=xlsx" data-survey-id="<%= survey.id.to_s %>" class="export-xls"><%= t('survey.export_csv') %></a></li> <li><a href="/admin/surveys/<%=survey.id.to_s%>/export?format=xlsx" data-survey-id="<%= survey.id.to_s %>" class="export-xls"><%= t('survey.export_xls') %></a></li>
<li><a href="/admin/surveys/<%=survey.id.to_s%>/set_sections"><%= t('survey.set_sections') %></a></li> <li><a href="/admin/surveys/<%=survey.id.to_s%>/set_sections"><%= t('survey.set_sections') %></a></li>
<li><a href="<%=page_for_survey(survey)%>?method=result&force_chart=true" target="_blank"><%= t('survey.chart') %></a></li> <li><a href="<%=page_for_survey(survey)%>?method=result&force_chart=true" target="_blank"><%= t('survey.chart') %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/surveys/<%=survey.id.to_s%>"><%= t(:delete_) %></a></li> <li><a href="#" class="delete text-error" rel="/admin/surveys/<%=survey.id.to_s%>"><%= t(:delete_) %></a></li>

View File

@ -137,7 +137,7 @@
is_sort: true is_sort: true
}, },
points: { points: {
radius: 3, radius: 5,
show: true show: true
}, },
downsample: { downsample: {

View File

@ -4,8 +4,8 @@ wb = xlsx_package.workbook
title = survey.title title = survey.title
title = "WorkSheet1" if title.blank? title = "WorkSheet1" if title.blank?
wb.add_worksheet(name: title) do |sheet| wb.add_worksheet(name: title) do |sheet|
row = [I18n.t("survey.taken_by")] row = [I18n.t("survey.taken_by"), I18n.t("survey.consent_to_be_used_for_research")]
row2 = [""] row2 = ["", ""]
survey_questions.each_with_index do |question, i| survey_questions.each_with_index do |question, i|
qnum = question.title.match(/^\d+./).nil? ? "#{i+1}. " : "" qnum = question.title.match(/^\d+./).nil? ? "#{i+1}. " : ""
start_col = row2.count start_col = row2.count

View File

@ -120,8 +120,8 @@
is_sort: true is_sort: true
}, },
points: { points: {
radius: 3, radius: 5,
show: false show: true
}, },
downsample: { downsample: {
threshold: 0 threshold: 0

View File

@ -2,6 +2,8 @@ en:
module_name: module_name:
survey: Survey survey: Survey
survey: survey:
'true': 'Yes'
'false': 'No'
consent_to_be_used_for_research: "Consent answer to be used for research" consent_to_be_used_for_research: "Consent answer to be used for research"
agree: Agree agree: Agree
consent_contents: '"Consent" contents' consent_contents: '"Consent" contents'
@ -55,6 +57,7 @@ en:
answer_error: Unsuccessful answer answer_error: Unsuccessful answer
answers_list: Answers List answers_list: Answers List
export_xls: Export Excel
export_csv: Export CSV export_csv: Export CSV
chart: Chart chart: Chart
set_answers: Set Answers set_answers: Set Answers

View File

@ -4,6 +4,8 @@ zh_tw:
survey: 問卷調查 survey: 問卷調查
survey: survey:
'true':
'false':
consent_to_be_used_for_research: "同意填答結果被用於研究" consent_to_be_used_for_research: "同意填答結果被用於研究"
agree: 同意 agree: 同意
consent_contents: '"同意書"內容' consent_contents: '"同意書"內容'
@ -62,6 +64,7 @@ zh_tw:
answer_error: 問卷填寫錯誤 answer_error: 問卷填寫錯誤
answers_list: 結果清單 answers_list: 結果清單
export_xls: 匯出Excel
export_csv: 匯出CSV export_csv: 匯出CSV
chart: 結果圖表 chart: 結果圖表
set_answers: 設定結果 set_answers: 設定結果