From 190e815f736fbc116cc874f45aa5709d53abd086 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 22 Jul 2020 12:29:54 +0200 Subject: [PATCH] [bug] unable to export subscriptions --- CHANGELOG.md | 1 + app/views/exports/users_subscriptions.xlsx.axlsx | 6 +++--- config/locales/en.yml | 1 + config/locales/fr.yml | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7812391e6..0e3f2cde9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Keep the history of footprints data for verification purposes - Enhanced rake task to create fixtures for test cases - Fix a bug: unable to export reservations +- Fix a bug: unable to export subscriptions - Fix a bug: unable to receive mails in development - [TODO DEPLOY] `rails fablab:maintenance:save_footprint_data` diff --git a/app/views/exports/users_subscriptions.xlsx.axlsx b/app/views/exports/users_subscriptions.xlsx.axlsx index 4b7257c9f..bdcf01590 100644 --- a/app/views/exports/users_subscriptions.xlsx.axlsx +++ b/app/views/exports/users_subscriptions.xlsx.axlsx @@ -15,9 +15,9 @@ wb.add_worksheet(name: t('export_subscriptions.subscriptions')) do |sheet| # data rows @subscriptions.each do |sub| data = [ - sub.user.id, - sub.user.profile.full_name, - sub.user.email, + sub.user&.id, + sub.user&.profile&.full_name || t('export_subscriptions.deleted_user'), + sub.user&.email, sub.plan.human_readable_name(group: true), t("duration.#{sub.plan.interval}", count: sub.plan.interval_count), sub.created_at.to_date, diff --git a/config/locales/en.yml b/config/locales/en.yml index 7073772f7..498cb5f90 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -203,6 +203,7 @@ en: payment_method: "Payment method" local_payment: "Payment at the reception" online_payment: "Online payment" + deleted_user: "Deleted user" #reservation slots export, by type, to EXCEL format export_availabilities: machines: "Machines" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index e1fc17e14..cdb54732a 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -203,6 +203,7 @@ fr: payment_method: "Méthode de paiement" local_payment: "Paiement à l'accueil" online_payment: "Paiement en ligne" + deleted_user: "Utilisateur supprimé" #reservation slots export, by type, to EXCEL format export_availabilities: machines: "Machines"