Füge Skript hinzu, um das Sichtbarkeitsflag für Geburtstage aller Mitglieder auf true zu setzen
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 52s

This commit is contained in:
Torsten Schulz (local)
2026-02-14 02:48:30 +01:00
parent e665495003
commit 64baaf8535
2 changed files with 69 additions and 10 deletions

View File

@@ -115,7 +115,12 @@
> >
<td class="px-4 py-3 whitespace-nowrap"> <td class="px-4 py-3 whitespace-nowrap">
<div class="text-sm font-medium text-gray-900"> <div class="text-sm font-medium text-gray-900">
<template v-if="member.lastName || member.firstName">
{{ member.firstName }} {{ member.lastName }}
</template>
<template v-else>
{{ member.name }} {{ member.name }}
</template>
</div> </div>
<div v-if="member.showBirthday && member.birthday" class="text-xs text-gray-500"> <div v-if="member.showBirthday && member.birthday" class="text-xs text-gray-500">
🎂 {{ formatBirthday(member.birthday) }} 🎂 {{ formatBirthday(member.birthday) }}
@@ -254,7 +259,12 @@
<div class="flex-1"> <div class="flex-1">
<div class="flex items-center mb-2"> <div class="flex items-center mb-2">
<h3 class="text-xl font-semibold text-gray-900"> <h3 class="text-xl font-semibold text-gray-900">
<template v-if="member.lastName || member.firstName">
{{ member.firstName }} {{ member.lastName }}
</template>
<template v-else>
{{ member.name }} {{ member.name }}
</template>
<span v-if="member.showBirthday && member.birthday" class="text-xs text-gray-500 ml-2"> <span v-if="member.showBirthday && member.birthday" class="text-xs text-gray-500 ml-2">
🎂 {{ formatBirthday(member.birthday) }} 🎂 {{ formatBirthday(member.birthday) }}
</span> </span>
@@ -765,18 +775,23 @@ const sortedMembers = computed(() => {
const arr = [...members.value] const arr = [...members.value]
if (sortMode.value === 'name') { if (sortMode.value === 'name') {
arr.sort((a, b) => { arr.sort((a, b) => {
const an = (a.name || '').toLocaleLowerCase() // Sortiere nach Vorname Nachname (firstName lastName), fallback auf name
const bn = (b.name || '').toLocaleLowerCase() const af = (a.firstName || (a.name ? a.name.split(' ')[0] : '') || '').toLocaleLowerCase()
return an.localeCompare(bn) const bf = (b.firstName || (b.name ? b.name.split(' ')[0] : '') || '').toLocaleLowerCase()
const al = (a.lastName || (a.name ? a.name.split(' ').slice(-1)[0] : '') || '').toLocaleLowerCase()
const bl = (b.lastName || (b.name ? b.name.split(' ').slice(-1)[0] : '') || '').toLocaleLowerCase()
if (af === bf) return al.localeCompare(bl)
return af.localeCompare(bf)
}) })
} else if (sortMode.value === 'lastname') { } else if (sortMode.value === 'lastname') {
arr.sort((a, b) => { arr.sort((a, b) => {
// Fallback: lastName, dann firstName // Sortiere nach Nachname, fallback auf letzten Teil von name
const al = (a.lastName || a.name?.split(' ').slice(-1)[0] || '').toLocaleLowerCase() const al = (a.lastName || (a.name ? a.name.split(' ').slice(-1)[0] : '') || '').toLocaleLowerCase()
const bl = (b.lastName || b.name?.split(' ').slice(-1)[0] || '').toLocaleLowerCase() const bl = (b.lastName || (b.name ? b.name.split(' ').slice(-1)[0] : '') || '').toLocaleLowerCase()
if (al === bl) { if (al === bl) {
const af = (a.firstName || a.name?.split(' ')[0] || '').toLocaleLowerCase() // Bei gleichem Nachnamen nach Vorname sortieren
const bf = (b.firstName || b.name?.split(' ')[0] || '').toLocaleLowerCase() const af = (a.firstName || (a.name ? a.name.split(' ')[0] : '') || '').toLocaleLowerCase()
const bf = (b.firstName || (b.name ? b.name.split(' ')[0] : '') || '').toLocaleLowerCase()
return af.localeCompare(bf) return af.localeCompare(bf)
} }
return al.localeCompare(bl) return al.localeCompare(bl)

View File

@@ -0,0 +1,44 @@
// Script: set-all-birthday-visible.js
// Setzt für alle Mitglieder das Flag visibility.showBirthday auf true
const fs = require('fs')
const path = require('path')
const membersPath = path.join(__dirname, 'data', 'members.json')
let raw
try {
raw = fs.readFileSync(membersPath, 'utf8')
} catch (e) {
console.error('Fehler beim Lesen von members.json:', e)
process.exit(1)
}
let members
try {
members = JSON.parse(raw)
} catch (e) {
console.error('Fehler beim Parsen von members.json:', e)
process.exit(1)
}
if (!Array.isArray(members)) {
console.error('members.json ist kein Array!')
process.exit(1)
}
let changed = 0
for (const m of members) {
if (!m.visibility) m.visibility = {}
if (m.visibility.showBirthday !== true) {
m.visibility.showBirthday = true
changed++
}
}
if (changed > 0) {
fs.writeFileSync(membersPath, JSON.stringify(members, null, 2), 'utf8')
console.log(`Flag für ${changed} Mitglieder gesetzt.`)
} else {
console.log('Alle Mitglieder hatten das Flag bereits gesetzt.')
}