Member registration fixed
Some checks failed
Code Analysis and Production Deploy / analyze (push) Failing after 6m17s
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Has been skipped

This commit is contained in:
Torsten Schulz (local)
2026-08-12 11:15:07 +02:00
parent 281c25b05d
commit cb89fdd911
15 changed files with 263 additions and 41 deletions

View File

@@ -221,14 +221,23 @@ export function normalizeDate(dateString) {
}
// Check for duplicate member based on firstName, lastName, and geburtsdatum
function findDuplicateMember(members, firstName, lastName, geburtsdatum) {
const normalizedFirstName = (firstName || '').trim().toLowerCase()
const normalizedLastName = (lastName || '').trim().toLowerCase()
function normalizeIdentityPart(value) {
return String(value || '')
.normalize('NFKD')
.replace(/[\u0300-\u036f]/g, '')
.replace(/[^a-zA-Z0-9]+/g, ' ')
.trim()
.toLowerCase()
}
export function findDuplicateMember(members, firstName, lastName, geburtsdatum) {
const normalizedFirstName = normalizeIdentityPart(firstName)
const normalizedLastName = normalizeIdentityPart(lastName)
const normalizedDate = normalizeDate(geburtsdatum)
return members.find(m => {
const mFirstName = (m.firstName || '').trim().toLowerCase()
const mLastName = (m.lastName || '').trim().toLowerCase()
const mFirstName = normalizeIdentityPart(m.firstName)
const mLastName = normalizeIdentityPart(m.lastName)
const mDate = normalizeDate(m.geburtsdatum)
return mFirstName === normalizedFirstName &&
@@ -307,4 +316,3 @@ export async function deleteMember(id) {
await writeMembers(filtered)
return true
}