simplifying export format
This commit is contained in:
parent
619b51e990
commit
73aea84e8e
1 changed files with 9 additions and 23 deletions
|
|
@ -304,42 +304,28 @@
|
|||
function exportRegistrations() {
|
||||
if (typeof window === 'undefined') return;
|
||||
const lines: string[] = [];
|
||||
const timestamp = formatDateTime(new Date().toISOString()) ?? new Date().toISOString();
|
||||
lines.push(`${tournament.title} – ${registrations.length} anmälningar`);
|
||||
lines.push(`Genererad ${timestamp}`);
|
||||
lines.push('');
|
||||
|
||||
if (registrations.length === 0) {
|
||||
lines.push('Inga anmälningar.');
|
||||
} else {
|
||||
for (const registration of registrations) {
|
||||
lines.push(`Anmälan #${registration.id}`);
|
||||
const created = formatDateTime(registration.created_at) ?? registration.created_at;
|
||||
lines.push(`Skapad: ${created}`);
|
||||
|
||||
if (entryFields().length > 0) {
|
||||
lines.push('Lag / deltagare:');
|
||||
lines.push(registrationHeading(registration));
|
||||
for (const field of entryFields()) {
|
||||
lines.push(` ${field.label}: ${fieldValue(registration.entry, field) || '—'}`);
|
||||
const value = fieldValue(registration.entry, field).trim();
|
||||
lines.push(`${field.label}: ${value || '—'}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (participantFields().length === 0) {
|
||||
if (registration.participants.length > 0) {
|
||||
lines.push(`Spelare: ${registration.participants.length}`);
|
||||
}
|
||||
} else if (registration.participants.length === 0) {
|
||||
lines.push('Spelare: inga angivna');
|
||||
} else {
|
||||
lines.push('Spelare:');
|
||||
if (participantFields().length > 0 && registration.participants.length > 0) {
|
||||
registration.participants.forEach((participant, index) => {
|
||||
lines.push('');
|
||||
lines.push(`Spelare ${index + 1}`);
|
||||
for (const field of participantFields()) {
|
||||
lines.push(` ${field.label}: ${fieldValue(participant, field) || '—'}`);
|
||||
const value = fieldValue(participant, field).trim();
|
||||
lines.push(`${field.label}: ${value || '—'}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
lines.push('');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue