new features
This commit is contained in:
@@ -65,6 +65,23 @@ function mapDienstgrad(raw: string): string | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Valid Austrian/EU driving license class patterns.
|
||||
* Filters out non-class data that the scraper may pick up from FDISK form fields.
|
||||
*/
|
||||
const VALID_LICENSE_CLASSES = new Set([
|
||||
'A', 'A1', 'A2', 'AM',
|
||||
'B', 'B1', 'BE',
|
||||
'C', 'C1', 'CE', 'C1E',
|
||||
'D', 'D1', 'DE', 'D1E',
|
||||
'F', 'G', 'L', 'T',
|
||||
]);
|
||||
|
||||
function isValidLicenseClass(klasse: string): boolean {
|
||||
const normalized = klasse.trim().toUpperCase();
|
||||
return VALID_LICENSE_CLASSES.has(normalized);
|
||||
}
|
||||
|
||||
export async function syncToDatabase(
|
||||
pool: Pool,
|
||||
members: FdiskMember[],
|
||||
@@ -362,6 +379,13 @@ async function syncFahrgenehmigungen(
|
||||
}
|
||||
|
||||
for (const f of fahrgenehmigungen) {
|
||||
// J2: Filter out non-class data that the scraper may pick up
|
||||
if (!f.klasse || !isValidLicenseClass(f.klasse)) {
|
||||
log(`Skipping Fahrgenehmigung: invalid klasse "${f.klasse}" for StNr ${f.standesbuchNr}`);
|
||||
skipped++;
|
||||
continue;
|
||||
}
|
||||
|
||||
const result = await client.query<{ user_id: string }>(
|
||||
`SELECT user_id FROM mitglieder_profile WHERE fdisk_standesbuch_nr = $1`,
|
||||
[f.standesbuchNr]
|
||||
|
||||
Reference in New Issue
Block a user