From ade678da1f838ef4687832d6cbc153259bee52da Mon Sep 17 00:00:00 2001 From: valentinkolb Date: Tue, 25 Jun 2024 01:10:59 +0200 Subject: [PATCH] feat(csv export): improved username in csv --- .../events/e/:eventId/EventLists/Search/DownloadDataModal.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/events/e/:eventId/EventLists/Search/DownloadDataModal.tsx b/src/pages/events/e/:eventId/EventLists/Search/DownloadDataModal.tsx index 76f4e39..da08b78 100644 --- a/src/pages/events/e/:eventId/EventLists/Search/DownloadDataModal.tsx +++ b/src/pages/events/e/:eventId/EventLists/Search/DownloadDataModal.tsx @@ -13,6 +13,7 @@ import {CSV_CHARSETS, downloadCsv} from "@/lib/csv.ts"; import {showSuccessNotification} from "@/components/util.tsx"; import {PocketBaseErrorAlert} from "@/lib/pocketbase.tsx"; import {formatDateForExcel} from "@/lib/datetime.ts"; +import {getUserName} from "@/components/users/modals/util.tsx"; type FormValues = { questionSchemaFields: string[] @@ -122,7 +123,7 @@ export default function DownloadDataModal({opened, onClose, lists, event, query} const statusData = e.entryStatusData || {} return [ ...(showDebug ? [e.user, e.id] : []), - e.expand?.user.username ?? "N/A", formatDateForExcel(e.created), e.listName, formatDateForExcel(e.slotStartDate), formatDateForExcel(e.slotEndDate), + getUserName(e.expand?.user) ?? "N/A", formatDateForExcel(e.created), e.listName, formatDateForExcel(e.slotStartDate), formatDateForExcel(e.slotEndDate), ...questionSchema.fields.map(f => questionData[f.id]?.value?.toString() ?? "N/A").map(escapeSeparator), ...statusSchema.fields.map(f => statusData[f.id]?.value?.toString() ?? "N/A").map(escapeSeparator) ]