diff --git a/app/views/api/statistics/export_current.xlsx.axlsx b/app/views/api/statistics/export_current.xlsx.axlsx index 81fbdf2bb..76c676854 100644 --- a/app/views/api/statistics/export_current.xlsx.axlsx +++ b/app/views/api/statistics/export_current.xlsx.axlsx @@ -32,9 +32,9 @@ wb.add_worksheet(name: @index.label) do |sheet| subtype = get_item(@subtypes, hit['_source']['subType'], 'key') data = [ Date::strptime(hit['_source']['date'],'%Y-%m-%d'), - user.profile.full_name, - user.email, - user.profile.phone, + (user ? user.profile.full_name : "ID #{hit['_source']['userId']}"), + (user ? user.email : ''), + (user ? user.profile.phone : ''), t("export.#{hit['_source']['gender']}"), hit['_source']['age'], subtype.nil? ? "" : subtype.label diff --git a/app/views/api/statistics/export_global.xlsx.axlsx b/app/views/api/statistics/export_global.xlsx.axlsx index 572acb8b7..dd00a277f 100644 --- a/app/views/api/statistics/export_global.xlsx.axlsx +++ b/app/views/api/statistics/export_global.xlsx.axlsx @@ -30,9 +30,9 @@ date = wb.styles.add_style :format_code => Rails.application.secrets.excel_date_ # start to fill data and associated styles and data-types data = [ Date::strptime(hit['_source']['date'],'%Y-%m-%d'), - user.profile.full_name, - user.email, - user.profile.phone, + (user ? user.profile.full_name : "ID #{hit['_source']['userId']}"), + (user ? user.email : ''), + (user ? user.profile.phone : ''), t("export.#{hit['_source']['gender']}"), hit['_source']['age'], subtype.nil? ? "" : subtype.label