feat(csv export): improved username in csv

This commit is contained in:
Valentin Kolb 2024-06-25 01:10:59 +02:00
parent 2d59172323
commit ade678da1f
1 changed files with 2 additions and 1 deletions

View File

@ -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)
]