This commit is contained in:
Matthias Hochmeister
2026-03-13 16:12:11 +01:00
parent 602d9fd5b9
commit 02d9d808b2
3 changed files with 66 additions and 13 deletions

View File

@@ -167,7 +167,9 @@ async function scrapeMembers(frame: Frame): Promise<FdiskMember[]> {
const cells = Array.from(tr.querySelectorAll('td'));
const val = (i: number) => {
const a = cells[i]?.querySelector('a');
return (a?.getAttribute('title') ?? cells[i]?.textContent ?? '').trim();
const title = a?.getAttribute('title')?.trim();
// Use title only if non-empty; otherwise fall back to textContent
return (title || cells[i]?.textContent || '').trim();
};
const href = (tr.querySelector('a') as HTMLAnchorElement | null)?.href ?? null;
return {
@@ -186,10 +188,16 @@ async function scrapeMembers(frame: Frame): Promise<FdiskMember[]> {
);
log(`Parsed ${rows.length} rows from member table`);
for (const row of rows) {
log(` Row: StNr="${row.standesbuchNr}" Vorname="${row.vorname}" Zuname="${row.zuname}" Status="${row.status}"`);
}
const members: FdiskMember[] = [];
for (const row of rows) {
if (!row.standesbuchNr || !row.vorname || !row.zuname) continue;
if (!row.standesbuchNr || !row.vorname || !row.zuname) {
log(` SKIP: StNr="${row.standesbuchNr}" Vorname="${row.vorname}" Zuname="${row.zuname}" — missing required field`);
continue;
}
const abmeldedatum = parseDate(row.abmeldedatum);
members.push({
standesbuchNr: row.standesbuchNr,