From 9243160b706904540c4d65f94105dcd3f3b84986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Sat, 31 Dec 2022 15:08:43 +0800 Subject: [PATCH] fix export error --- app/controllers/admin/asks_controller.rb | 2 +- app/views/admin/asks/do_export.xlsx.axlsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/asks_controller.rb b/app/controllers/admin/asks_controller.rb index a3f5eec..e74dcd3 100644 --- a/app/controllers/admin/asks_controller.rb +++ b/app/controllers/admin/asks_controller.rb @@ -437,7 +437,7 @@ class Admin::AsksController < OrbitAdminController end def get_fields_with_key(s) fields_with_key = {} - fields_with_key['default_values'] = s.default_setting.collect{|k,v| [k, process_trans(s.field_name_translations(k))] if v && k!='ask_category_id'}.compact + fields_with_key['default_values'] = s.default_setting.collect{|k,v| [k, process_trans(s.field_name_translations(k))] if v && !['ask_category_id','recaptcha'].include?(k)}.compact fields_with_key['default_values'] = [['ask_category_id', process_trans(s.field_name_translations('ask_category_id'))]] + fields_with_key['default_values'] fields_with_key['default_values'] = fields_with_key['default_values'].to_h fields_with_key['custom_values'] = s.custom_fields.collect{|k, field_setting| [k, process_trans(field_setting['field'])]}.to_h diff --git a/app/views/admin/asks/do_export.xlsx.axlsx b/app/views/admin/asks/do_export.xlsx.axlsx index 13ca01f..1c2a309 100644 --- a/app/views/admin/asks/do_export.xlsx.axlsx +++ b/app/views/admin/asks/do_export.xlsx.axlsx @@ -27,7 +27,7 @@ wb.add_worksheet(name: "Ask Question") do |sheet| when 'title','name','mail','phone','appointment' text = ask_question.send(key).to_s when 'ask_category_id' - text = categories[ask_question.ask_category_id].title rescue '' + text = categories[ask_question.category_id].title rescue '' when 'sex' text = ask_question.sex if ['male','female'].include? sex.to_s