feat(MembersOverviewSection, i18n): add QTTR sorting option and localization support
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 42s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 42s
- Introduced a new sorting option for QTTR values in the MembersOverviewSection, enhancing data organization capabilities. - Updated localization files for multiple languages to include translations for the new QTTR sorting option, ensuring consistent user experience across different locales. - Implemented logic to handle QTTR sorting in the MembersView, allowing users to sort members based on their QTTR values effectively.
This commit is contained in:
@@ -189,6 +189,7 @@
|
||||
<option value="firstName">{{ $t('members.sortFirstName') }}</option>
|
||||
<option value="birthday">{{ $t('members.sortBirthday') }}</option>
|
||||
<option value="age">{{ $t('members.sortAge') }}</option>
|
||||
<option value="qttr">{{ $t('members.sortQttr') }}</option>
|
||||
<option value="lastTraining">{{ $t('members.sortLastTraining') }}</option>
|
||||
<option value="openTasks">{{ $t('members.sortOpenTasks') }}</option>
|
||||
</select>
|
||||
|
||||
@@ -637,6 +637,7 @@
|
||||
"sortFirstName": "Vorname",
|
||||
"sortBirthday": "Geburtstag",
|
||||
"sortAge": "Alter",
|
||||
"sortQttr": "QTTR-Wert",
|
||||
"ageRange": "Alter von - bis",
|
||||
"ageFromPlaceholder": "von",
|
||||
"ageToPlaceholder": "bis",
|
||||
|
||||
@@ -384,6 +384,7 @@
|
||||
"sortFirstName": "Vorname",
|
||||
"sortBirthday": "Geburtstag",
|
||||
"sortAge": "Alter",
|
||||
"sortQttr": "QTTR-Wert",
|
||||
"ageRange": "Alter von - bis",
|
||||
"ageFromPlaceholder": "von",
|
||||
"ageToPlaceholder": "bis",
|
||||
|
||||
@@ -385,6 +385,7 @@
|
||||
"sortFirstName": "Vorname",
|
||||
"sortBirthday": "Geburtstag",
|
||||
"sortAge": "Alter",
|
||||
"sortQttr": "QTTR-Wert",
|
||||
"ageRange": "Alter von - bis",
|
||||
"ageFromPlaceholder": "von",
|
||||
"ageToPlaceholder": "bis",
|
||||
|
||||
@@ -636,6 +636,7 @@
|
||||
"sortFirstName": "First name",
|
||||
"sortBirthday": "Birthday",
|
||||
"sortAge": "Age",
|
||||
"sortQttr": "QTTR value",
|
||||
"ageRange": "Age from - to",
|
||||
"ageFromPlaceholder": "from",
|
||||
"ageToPlaceholder": "to",
|
||||
|
||||
@@ -911,6 +911,7 @@
|
||||
"sortFirstName": "First name",
|
||||
"sortBirthday": "Birthday",
|
||||
"sortAge": "Age",
|
||||
"sortQttr": "QTTR value",
|
||||
"ageRange": "Age from - to",
|
||||
"ageFromPlaceholder": "from",
|
||||
"ageToPlaceholder": "to",
|
||||
|
||||
@@ -636,6 +636,7 @@
|
||||
"sortFirstName": "First name",
|
||||
"sortBirthday": "Birthday",
|
||||
"sortAge": "Age",
|
||||
"sortQttr": "QTTR value",
|
||||
"ageRange": "Age from - to",
|
||||
"ageFromPlaceholder": "from",
|
||||
"ageToPlaceholder": "to",
|
||||
|
||||
@@ -602,6 +602,7 @@
|
||||
"sortFirstName": "Nombre",
|
||||
"sortBirthday": "Fecha de nacimiento",
|
||||
"sortAge": "Edad",
|
||||
"sortQttr": "Valor QTTR",
|
||||
"ageRange": "Edad de - a",
|
||||
"ageFromPlaceholder": "de",
|
||||
"ageToPlaceholder": "a",
|
||||
|
||||
@@ -602,6 +602,7 @@
|
||||
"sortFirstName": "First name",
|
||||
"sortBirthday": "Birthday",
|
||||
"sortAge": "Age",
|
||||
"sortQttr": "Halaga ng QTTR",
|
||||
"ageRange": "Edad mula - hanggang",
|
||||
"ageFromPlaceholder": "mula",
|
||||
"ageToPlaceholder": "hanggang",
|
||||
|
||||
@@ -602,6 +602,7 @@
|
||||
"sortFirstName": "Prénom",
|
||||
"sortBirthday": "Date de naissance",
|
||||
"sortAge": "Âge",
|
||||
"sortQttr": "Valeur QTTR",
|
||||
"ageRange": "Âge de - à",
|
||||
"ageFromPlaceholder": "de",
|
||||
"ageToPlaceholder": "à",
|
||||
|
||||
@@ -602,6 +602,7 @@
|
||||
"sortFirstName": "Nome",
|
||||
"sortBirthday": "Data di nascita",
|
||||
"sortAge": "Età",
|
||||
"sortQttr": "Valore QTTR",
|
||||
"ageRange": "Età da - a",
|
||||
"ageFromPlaceholder": "da",
|
||||
"ageToPlaceholder": "a",
|
||||
|
||||
@@ -602,6 +602,7 @@
|
||||
"sortFirstName": "First name",
|
||||
"sortBirthday": "Birthday",
|
||||
"sortAge": "Age",
|
||||
"sortQttr": "QTTR値",
|
||||
"ageRange": "年齢範囲",
|
||||
"ageFromPlaceholder": "から",
|
||||
"ageToPlaceholder": "まで",
|
||||
|
||||
@@ -602,6 +602,7 @@
|
||||
"sortFirstName": "Imię",
|
||||
"sortBirthday": "Data urodzenia",
|
||||
"sortAge": "Wiek",
|
||||
"sortQttr": "Wartość QTTR",
|
||||
"ageRange": "Wiek od - do",
|
||||
"ageFromPlaceholder": "od",
|
||||
"ageToPlaceholder": "do",
|
||||
|
||||
@@ -602,6 +602,7 @@
|
||||
"sortFirstName": "First name",
|
||||
"sortBirthday": "Birthday",
|
||||
"sortAge": "Age",
|
||||
"sortQttr": "ค่า QTTR",
|
||||
"ageRange": "ช่วงอายุ",
|
||||
"ageFromPlaceholder": "จาก",
|
||||
"ageToPlaceholder": "ถึง",
|
||||
|
||||
@@ -602,6 +602,7 @@
|
||||
"sortFirstName": "First name",
|
||||
"sortBirthday": "Birthday",
|
||||
"sortAge": "Age",
|
||||
"sortQttr": "Halaga ng QTTR",
|
||||
"ageRange": "Edad mula - hanggang",
|
||||
"ageFromPlaceholder": "mula",
|
||||
"ageToPlaceholder": "hanggang",
|
||||
|
||||
@@ -602,6 +602,7 @@
|
||||
"sortFirstName": "First name",
|
||||
"sortBirthday": "Birthday",
|
||||
"sortAge": "Age",
|
||||
"sortQttr": "QTTR值",
|
||||
"ageRange": "年龄范围",
|
||||
"ageFromPlaceholder": "从",
|
||||
"ageToPlaceholder": "到",
|
||||
|
||||
@@ -916,6 +916,10 @@ 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);
|
||||
return Number.isFinite(parsed) ? parsed : null;
|
||||
};
|
||||
const compareStrings = (a, b) => String(a || '').localeCompare(String(b || ''), 'de-DE');
|
||||
const direction = this.sortDirection === 'desc' ? -1 : 1;
|
||||
|
||||
@@ -931,6 +935,24 @@ export default {
|
||||
case 'age':
|
||||
result = getAgeValue(a) - getAgeValue(b) || compareStrings(a.lastName, b.lastName);
|
||||
break;
|
||||
case 'qttr': {
|
||||
const qttrA = getQttrValue(a);
|
||||
const qttrB = getQttrValue(b);
|
||||
const hasQttrA = qttrA !== null;
|
||||
const hasQttrB = qttrB !== null;
|
||||
|
||||
// Fehlende QTTR-Werte immer nach unten sortieren, unabhängig von der Sortierrichtung.
|
||||
if (!hasQttrA && hasQttrB) {
|
||||
result = 1;
|
||||
} else if (hasQttrA && !hasQttrB) {
|
||||
result = -1;
|
||||
} else if (!hasQttrA && !hasQttrB) {
|
||||
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);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'lastTraining':
|
||||
result = getLastTrainingValue(a) - getLastTrainingValue(b) || compareStrings(a.lastName, b.lastName);
|
||||
break;
|
||||
@@ -942,6 +964,10 @@ 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') {
|
||||
return result;
|
||||
}
|
||||
return result * direction;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user