Include email address and year in csv exporter

This commit is contained in:
Luke Vella 2023-10-27 12:03:23 +01:00
parent b10c64b7da
commit 692068bc5d

View file

@ -14,11 +14,10 @@ export const useCsvExporter = () => {
return { return {
exportToCsv: () => { exportToCsv: () => {
const header = [ const header = [
t("participantCount", { t("name"),
count: participants.length, t("email"),
}),
...options.map((decodedOption) => { ...options.map((decodedOption) => {
const day = `${decodedOption.dow} ${decodedOption.day} ${decodedOption.month}`; const day = `${decodedOption.dow} ${decodedOption.day} ${decodedOption.month} ${decodedOption.year}`;
return decodedOption.type === "date" return decodedOption.type === "date"
? day ? day
: `${day} ${decodedOption.startTime} - ${decodedOption.endTime}`; : `${day} ${decodedOption.startTime} - ${decodedOption.endTime}`;
@ -27,6 +26,7 @@ export const useCsvExporter = () => {
const rows = participants.map((participant) => { const rows = participants.map((participant) => {
return [ return [
participant.name, participant.name,
participant.email,
...poll.options.map((option) => { ...poll.options.map((option) => {
const vote = participant.votes.find((vote) => { const vote = participant.votes.find((vote) => {
return vote.optionId === option.id; return vote.optionId === option.id;