fix export error

This commit is contained in:
邱博亞 2022-12-31 15:08:43 +08:00
parent f4c7be63c9
commit 9243160b70
2 changed files with 2 additions and 2 deletions

View File

@ -437,7 +437,7 @@ class Admin::AsksController < OrbitAdminController
end end
def get_fields_with_key(s) def get_fields_with_key(s)
fields_with_key = {} 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'] = [['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['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 fields_with_key['custom_values'] = s.custom_fields.collect{|k, field_setting| [k, process_trans(field_setting['field'])]}.to_h

View File

@ -27,7 +27,7 @@ wb.add_worksheet(name: "Ask Question") do |sheet|
when 'title','name','mail','phone','appointment' when 'title','name','mail','phone','appointment'
text = ask_question.send(key).to_s text = ask_question.send(key).to_s
when 'ask_category_id' when 'ask_category_id'
text = categories[ask_question.ask_category_id].title rescue '' text = categories[ask_question.category_id].title rescue ''
when 'sex' when 'sex'
text = ask_question.sex text = ask_question.sex
if ['male','female'].include? sex.to_s if ['male','female'].include? sex.to_s