refactor(mitglieder): replace legacy status values (passiv/anwärter/ausgetreten/…) with aktiv/kind/jugend/reserve across backend, frontend, and sync
This commit is contained in:
@@ -33,6 +33,20 @@ async function dumpHtml(frame: Frame, label: string): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a raw FDISK status string to a dashboard status value.
|
||||
* Returns null for unknown/unneeded statuses — those members should be skipped.
|
||||
*/
|
||||
function mapFdiskStatus(raw: string): 'aktiv' | 'kind' | 'jugend' | 'reserve' | null {
|
||||
switch (raw.trim()) {
|
||||
case 'Aktiv': return 'aktiv';
|
||||
case 'Kind': return 'kind';
|
||||
case 'Jugend': return 'jugend';
|
||||
case 'Reserve': return 'reserve';
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
function log(msg: string) {
|
||||
console.log(`[scraper] ${new Date().toISOString()} ${msg}`);
|
||||
}
|
||||
@@ -153,6 +167,8 @@ async function scrapeKnownMembers(
|
||||
const members: FdiskMember[] = [];
|
||||
for (const row of allRows) {
|
||||
if (!row.standesbuchNr || !row.vorname || !row.zuname) continue;
|
||||
const status = mapFdiskStatus(row.status);
|
||||
if (!status) continue; // skip members with non-synced statuses
|
||||
const abmeldedatum = parseDate(row.abmeldedatum);
|
||||
members.push({
|
||||
standesbuchNr: row.standesbuchNr,
|
||||
@@ -163,7 +179,7 @@ async function scrapeKnownMembers(
|
||||
svnr: row.svnr || null,
|
||||
eintrittsdatum: parseDate(row.eintrittsdatum),
|
||||
abmeldedatum,
|
||||
status: abmeldedatum ? 'ausgetreten' : 'aktiv',
|
||||
status,
|
||||
detailUrl: row.href,
|
||||
geburtsort: null,
|
||||
geschlecht: null,
|
||||
@@ -593,6 +609,8 @@ async function scrapeMembers(frame: Frame): Promise<FdiskMember[]> {
|
||||
const members: FdiskMember[] = [];
|
||||
for (const row of allRows) {
|
||||
if (!row.standesbuchNr || !row.vorname || !row.zuname) continue;
|
||||
const status = mapFdiskStatus(row.status);
|
||||
if (!status) continue; // skip members with non-synced statuses
|
||||
const abmeldedatum = parseDate(row.abmeldedatum);
|
||||
members.push({
|
||||
standesbuchNr: row.standesbuchNr,
|
||||
@@ -603,7 +621,7 @@ async function scrapeMembers(frame: Frame): Promise<FdiskMember[]> {
|
||||
svnr: row.svnr || null,
|
||||
eintrittsdatum: parseDate(row.eintrittsdatum),
|
||||
abmeldedatum,
|
||||
status: abmeldedatum ? 'ausgetreten' : 'aktiv',
|
||||
status,
|
||||
detailUrl: row.href,
|
||||
geburtsort: null,
|
||||
geschlecht: null,
|
||||
|
||||
Reference in New Issue
Block a user