🎂 {{ formatBirthday(member.birthday) }}
@@ -254,7 +259,12 @@
- {{ member.name }}
+
+ {{ member.firstName }} {{ member.lastName }}
+
+
+ {{ member.name }}
+
🎂 {{ formatBirthday(member.birthday) }}
@@ -765,18 +775,23 @@ const sortedMembers = computed(() => {
const arr = [...members.value]
if (sortMode.value === 'name') {
arr.sort((a, b) => {
- const an = (a.name || '').toLocaleLowerCase()
- const bn = (b.name || '').toLocaleLowerCase()
- return an.localeCompare(bn)
+ // Sortiere nach Vorname Nachname (firstName lastName), fallback auf name
+ const af = (a.firstName || (a.name ? a.name.split(' ')[0] : '') || '').toLocaleLowerCase()
+ 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') {
arr.sort((a, b) => {
- // Fallback: lastName, dann firstName
- const al = (a.lastName || a.name?.split(' ').slice(-1)[0] || '').toLocaleLowerCase()
- const bl = (b.lastName || b.name?.split(' ').slice(-1)[0] || '').toLocaleLowerCase()
+ // Sortiere nach Nachname, fallback auf letzten Teil von name
+ 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 (al === bl) {
- const af = (a.firstName || a.name?.split(' ')[0] || '').toLocaleLowerCase()
- const bf = (b.firstName || b.name?.split(' ')[0] || '').toLocaleLowerCase()
+ // Bei gleichem Nachnamen nach Vorname sortieren
+ 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 al.localeCompare(bl)
diff --git a/server/set-all-birthday-visible.js b/server/set-all-birthday-visible.js
new file mode 100644
index 0000000..8ca8d42
--- /dev/null
+++ b/server/set-all-birthday-visible.js
@@ -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.')
+}