From d2d73e4548a9a56af960afe7659906664489b008 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Wed, 2 Sep 2026 14:50:35 +0200 Subject: [PATCH] feat(members): add TTR sorting option and update related functionality --- .../members/MembersOverviewSection.vue | 1 + frontend/src/i18n/locales/ceb.json | 1 + frontend/src/i18n/locales/de-extended.json | 1 + frontend/src/i18n/locales/de.json | 1 + frontend/src/i18n/locales/en-AU.json | 1 + frontend/src/i18n/locales/en-GB.json | 1 + frontend/src/i18n/locales/en-US.json | 1 + frontend/src/i18n/locales/es.json | 1 + frontend/src/i18n/locales/fil.json | 1 + frontend/src/i18n/locales/fr.json | 1 + frontend/src/i18n/locales/it.json | 1 + frontend/src/i18n/locales/ja.json | 1 + frontend/src/i18n/locales/pl.json | 1 + frontend/src/i18n/locales/th.json | 1 + frontend/src/i18n/locales/tl.json | 1 + frontend/src/i18n/locales/zh.json | 1 + frontend/src/views/MembersView.vue | 28 ++++++++++--------- 17 files changed, 31 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/members/MembersOverviewSection.vue b/frontend/src/components/members/MembersOverviewSection.vue index 2f70daa3..3a13f9b9 100755 --- a/frontend/src/components/members/MembersOverviewSection.vue +++ b/frontend/src/components/members/MembersOverviewSection.vue @@ -187,6 +187,7 @@ + diff --git a/frontend/src/i18n/locales/ceb.json b/frontend/src/i18n/locales/ceb.json index f9f03519..63db137f 100755 --- a/frontend/src/i18n/locales/ceb.json +++ b/frontend/src/i18n/locales/ceb.json @@ -486,6 +486,7 @@ "sortFirstName": "Ngalan", "sortBirthday": "Adlawng natawhan", "sortAge": "Edad", + "sortTtr": "TTR value", "sortQttr": "QTTR value", "ageRange": "Edad gikan - hangtod", "ageFromPlaceholder": "gikan", diff --git a/frontend/src/i18n/locales/de-extended.json b/frontend/src/i18n/locales/de-extended.json index 79540ecf..dcb9ba8e 100755 --- a/frontend/src/i18n/locales/de-extended.json +++ b/frontend/src/i18n/locales/de-extended.json @@ -485,6 +485,7 @@ "sortFirstName": "Vorname", "sortBirthday": "Geburtstag", "sortAge": "Alter", + "sortTtr": "TTR-Wert", "sortQttr": "QTTR-Wert", "ageRange": "Alter von - bis", "ageFromPlaceholder": "von", diff --git a/frontend/src/i18n/locales/de.json b/frontend/src/i18n/locales/de.json index 454ade09..6a32fd40 100755 --- a/frontend/src/i18n/locales/de.json +++ b/frontend/src/i18n/locales/de.json @@ -504,6 +504,7 @@ "sortFirstName": "Vorname", "sortBirthday": "Geburtstag", "sortAge": "Alter", + "sortTtr": "TTR-Wert", "sortQttr": "QTTR-Wert", "ageRange": "Alter von - bis", "ageFromPlaceholder": "von", diff --git a/frontend/src/i18n/locales/en-AU.json b/frontend/src/i18n/locales/en-AU.json index 64b4e577..f388b51e 100755 --- a/frontend/src/i18n/locales/en-AU.json +++ b/frontend/src/i18n/locales/en-AU.json @@ -494,6 +494,7 @@ "sortFirstName": "First name", "sortBirthday": "Birthday", "sortAge": "Age", + "sortTtr": "TTR value", "sortQttr": "QTTR value", "ageRange": "Age from - to", "ageFromPlaceholder": "from", diff --git a/frontend/src/i18n/locales/en-GB.json b/frontend/src/i18n/locales/en-GB.json index fb071e44..67c399e0 100755 --- a/frontend/src/i18n/locales/en-GB.json +++ b/frontend/src/i18n/locales/en-GB.json @@ -494,6 +494,7 @@ "sortFirstName": "First name", "sortBirthday": "Birthday", "sortAge": "Age", + "sortTtr": "TTR value", "sortQttr": "QTTR value", "ageRange": "Age from - to", "ageFromPlaceholder": "from", diff --git a/frontend/src/i18n/locales/en-US.json b/frontend/src/i18n/locales/en-US.json index 3198d2db..8020d262 100755 --- a/frontend/src/i18n/locales/en-US.json +++ b/frontend/src/i18n/locales/en-US.json @@ -494,6 +494,7 @@ "sortFirstName": "First name", "sortBirthday": "Birthday", "sortAge": "Age", + "sortTtr": "TTR value", "sortQttr": "QTTR value", "ageRange": "Age from - to", "ageFromPlaceholder": "from", diff --git a/frontend/src/i18n/locales/es.json b/frontend/src/i18n/locales/es.json index 070908fb..fe75e8e7 100755 --- a/frontend/src/i18n/locales/es.json +++ b/frontend/src/i18n/locales/es.json @@ -502,6 +502,7 @@ "sortFirstName": "Nombre", "sortBirthday": "Fecha de nacimiento", "sortAge": "Edad", + "sortTtr": "Valor TTR", "sortQttr": "Valor QTTR", "ageRange": "Edad de - a", "ageFromPlaceholder": "de", diff --git a/frontend/src/i18n/locales/fil.json b/frontend/src/i18n/locales/fil.json index 9ab8f75e..9760f308 100755 --- a/frontend/src/i18n/locales/fil.json +++ b/frontend/src/i18n/locales/fil.json @@ -501,6 +501,7 @@ "sortFirstName": "Pangalan", "sortBirthday": "Birthday", "sortAge": "Edad", + "sortTtr": "Halaga ng TTR", "sortQttr": "Halaga ng QTTR", "ageRange": "Edad mula - hanggang", "ageFromPlaceholder": "mula", diff --git a/frontend/src/i18n/locales/fr.json b/frontend/src/i18n/locales/fr.json index b098a750..f0bd5205 100755 --- a/frontend/src/i18n/locales/fr.json +++ b/frontend/src/i18n/locales/fr.json @@ -498,6 +498,7 @@ "sortFirstName": "Prénom", "sortBirthday": "Date de naissance", "sortAge": "Âge", + "sortTtr": "Valeur TTR", "sortQttr": "Valeur QTTR", "ageRange": "Âge de - à", "ageFromPlaceholder": "de", diff --git a/frontend/src/i18n/locales/it.json b/frontend/src/i18n/locales/it.json index 79313c44..d8cd8ee1 100755 --- a/frontend/src/i18n/locales/it.json +++ b/frontend/src/i18n/locales/it.json @@ -500,6 +500,7 @@ "sortFirstName": "Nome", "sortBirthday": "Data di nascita", "sortAge": "Età", + "sortTtr": "Valore TTR", "sortQttr": "Valore QTTR", "ageRange": "Età da - a", "ageFromPlaceholder": "da", diff --git a/frontend/src/i18n/locales/ja.json b/frontend/src/i18n/locales/ja.json index 9b826911..926ac811 100755 --- a/frontend/src/i18n/locales/ja.json +++ b/frontend/src/i18n/locales/ja.json @@ -502,6 +502,7 @@ "sortFirstName": "ファーストネーム", "sortBirthday": "誕生日", "sortAge": "年", + "sortTtr": "TTR値", "sortQttr": "QTTR値", "ageRange": "年齢範囲", "ageFromPlaceholder": "から", diff --git a/frontend/src/i18n/locales/pl.json b/frontend/src/i18n/locales/pl.json index 50d9a344..f33c6de9 100755 --- a/frontend/src/i18n/locales/pl.json +++ b/frontend/src/i18n/locales/pl.json @@ -499,6 +499,7 @@ "sortFirstName": "Imię", "sortBirthday": "Data urodzenia", "sortAge": "Wiek", + "sortTtr": "Wartość TTR", "sortQttr": "Wartość QTTR", "ageRange": "Wiek od - do", "ageFromPlaceholder": "od", diff --git a/frontend/src/i18n/locales/th.json b/frontend/src/i18n/locales/th.json index 69a20a29..1ac3848d 100755 --- a/frontend/src/i18n/locales/th.json +++ b/frontend/src/i18n/locales/th.json @@ -504,6 +504,7 @@ "sortFirstName": "ชื่อ", "sortBirthday": "วันเกิด", "sortAge": "อายุ", + "sortTtr": "ค่า TTR", "sortQttr": "ค่า QTTR", "ageRange": "ช่วงอายุ", "ageFromPlaceholder": "จาก", diff --git a/frontend/src/i18n/locales/tl.json b/frontend/src/i18n/locales/tl.json index 26165bb8..8d065129 100755 --- a/frontend/src/i18n/locales/tl.json +++ b/frontend/src/i18n/locales/tl.json @@ -500,6 +500,7 @@ "sortFirstName": "Pangalan", "sortBirthday": "Birthday", "sortAge": "Edad", + "sortTtr": "Halaga ng TTR", "sortQttr": "Halaga ng QTTR", "ageRange": "Edad mula - hanggang", "ageFromPlaceholder": "mula", diff --git a/frontend/src/i18n/locales/zh.json b/frontend/src/i18n/locales/zh.json index 3494fff8..5e99dc0e 100755 --- a/frontend/src/i18n/locales/zh.json +++ b/frontend/src/i18n/locales/zh.json @@ -503,6 +503,7 @@ "sortFirstName": "名", "sortBirthday": "生日", "sortAge": "年龄", + "sortTtr": "TTR值", "sortQttr": "QTTR值", "ageRange": "年龄范围", "ageFromPlaceholder": "从", diff --git a/frontend/src/views/MembersView.vue b/frontend/src/views/MembersView.vue index 7cd552dd..c35655de 100755 --- a/frontend/src/views/MembersView.vue +++ b/frontend/src/views/MembersView.vue @@ -1113,8 +1113,8 @@ export default { const date = new Date(member.lastTraining); return Number.isNaN(date.getTime()) ? Number.MAX_SAFE_INTEGER : date.getTime(); }; - const getQttrValue = (member) => { - const parsed = Number.parseFloat(member?.qttr); + const getRatingValue = (member, rating) => { + const parsed = Number.parseFloat(member?.[rating]); return Number.isFinite(parsed) ? parsed : null; }; const compareStrings = (a, b) => String(a || '').localeCompare(String(b || ''), 'de-DE'); @@ -1132,21 +1132,23 @@ export default { case 'age': result = getAgeValue(a) - getAgeValue(b) || compareStrings(a.lastName, b.lastName); break; + case 'ttr': case 'qttr': { - const qttrA = getQttrValue(a); - const qttrB = getQttrValue(b); - const hasQttrA = qttrA !== null; - const hasQttrB = qttrB !== null; + const rating = this.selectedSort; + const ratingA = getRatingValue(a, rating); + const ratingB = getRatingValue(b, rating); + const hasRatingA = ratingA !== null; + const hasRatingB = ratingB !== null; - // Fehlende QTTR-Werte immer nach unten sortieren, unabhängig von der Sortierrichtung. - if (!hasQttrA && hasQttrB) { + // Fehlende TTR-/QTTR-Werte immer nach unten sortieren, unabhängig von der Sortierrichtung. + if (!hasRatingA && hasRatingB) { result = 1; - } else if (hasQttrA && !hasQttrB) { + } else if (hasRatingA && !hasRatingB) { result = -1; - } else if (!hasQttrA && !hasQttrB) { + } else if (!hasRatingA && !hasRatingB) { result = compareStrings(a.lastName, b.lastName) || compareStrings(a.firstName, b.firstName); } else { - result = (qttrA - qttrB) * direction || compareStrings(a.lastName, b.lastName) || compareStrings(a.firstName, b.firstName); + result = (ratingA - ratingB) * direction || compareStrings(a.lastName, b.lastName) || compareStrings(a.firstName, b.firstName); } break; } @@ -1161,8 +1163,8 @@ export default { result = compareStrings(a.lastName, b.lastName) || compareStrings(a.firstName, b.firstName); break; } - // QTTR berücksichtigt die Sortierrichtung bereits im Zweig selbst. - if (this.selectedSort === 'qttr') { + // TTR und QTTR berücksichtigen die Sortierrichtung bereits im Zweig selbst. + if (this.selectedSort === 'ttr' || this.selectedSort === 'qttr') { return result; } return result * direction;