Improve conditionLabel method in BranchView component to handle edge cases and ensure accurate state representation. Added checks for null and undefined values, and clarified the return value for zero or negative conditions.
This commit is contained in:
@@ -692,7 +692,10 @@ export default {
|
||||
},
|
||||
|
||||
conditionLabel(value) {
|
||||
const v = Number(value) || 0;
|
||||
// 0 ist ein gültiger Zustand (z.B. komplett kaputt) und darf nicht als "Unbekannt" enden.
|
||||
if (value === null || value === undefined) return 'Unbekannt';
|
||||
const v = Number(value);
|
||||
if (!Number.isFinite(v)) return 'Unbekannt';
|
||||
if (v >= 95) return 'Ausgezeichnet'; // 95–100
|
||||
if (v >= 72) return 'Sehr gut'; // 72–94
|
||||
if (v >= 54) return 'Gut'; // 54–71
|
||||
@@ -700,7 +703,7 @@ export default {
|
||||
if (v >= 22) return 'Schlecht'; // 22–38
|
||||
if (v >= 6) return 'Sehr schlecht'; // 6–21
|
||||
if (v >= 1) return 'Katastrophal'; // 1–5
|
||||
return 'Unbekannt';
|
||||
return 'Katastrophal'; // 0 oder kleiner
|
||||
},
|
||||
|
||||
speedLabel(value) {
|
||||
|
||||
Reference in New Issue
Block a user