diff --git a/CHANGELOG.md b/CHANGELOG.md index c3cc8c0b3..383d5e588 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Next release +- Fix a bug: unable to show gender in global export + ## v6.3.27 2024 June 12 - Fix a bug: unable to show gender wowan in member export diff --git a/app/helpers/excel_helper.rb b/app/helpers/excel_helper.rb index 3cf3c14c4..77c1377f2 100644 --- a/app/helpers/excel_helper.rb +++ b/app/helpers/excel_helper.rb @@ -31,7 +31,7 @@ def statistics_line(hit, user, type, subtype, date_format) user&.profile&.full_name || t('export.deleted_user'), user&.email || '', user&.profile&.phone || '', - hit['_source']['gender'].nil? ? t("export.#{hit['_source']['gender']}") : '', + !hit['_source']['gender'].nil? ? t("export.#{hit['_source']['gender']}") : '', hit['_source']['age'], subtype.nil? ? '' : subtype.label ] diff --git a/app/models/statistic_profile.rb b/app/models/statistic_profile.rb index 4bd910163..a050ce876 100644 --- a/app/models/statistic_profile.rb +++ b/app/models/statistic_profile.rb @@ -31,7 +31,7 @@ class StatisticProfile < ApplicationRecord validate :check_birthday_in_past def str_gender - return '' if gender.blank? + return '' if gender.nil? gender ? 'male' : 'female' end diff --git a/app/views/exports/users_members.xlsx.axlsx b/app/views/exports/users_members.xlsx.axlsx index d63eccf32..929c562a8 100644 --- a/app/views/exports/users_members.xlsx.axlsx +++ b/app/views/exports/users_members.xlsx.axlsx @@ -51,7 +51,7 @@ wb.add_worksheet(name: ExcelService.name_safe(t('export_members.members'))) do | member.email, member.is_allow_newsletter, member.last_sign_in_at&.to_date, - member.statistic_profile.gender.nil? ? (member.statistic_profile.gender ? t('export_members.man') : t('export_members.woman')) : '', + !member.statistic_profile.gender.nil? ? (member.statistic_profile.gender ? t('export_members.man') : t('export_members.woman')) : '', member.statistic_profile.age, member.invoicing_profile&.address&.address || '', member.profile.phone,