API sortiert nach IdLD aber noch kein Messwert und Schleifenwert enthalten

This commit is contained in:
ISA
2024-08-10 11:09:53 +02:00
parent b7116a1e6f
commit b0a4b5accd

View File

@@ -89,6 +89,7 @@ const useLineData = (webserviceGisLinesStatusUrl, setLineStatusData) => {
return { lineColors, tooltipContents };
};
//----------------------------------------------------------
// Funktion zum Loggen der gruppierten und aggregierten Daten
function logGroupedData(statisList) {
@@ -103,15 +104,14 @@ function logGroupedData(statisList) {
acc[IdLD][Modul] = {
ModulName: ModulName || "Unknown",
ModulTyp: ModulTyp || "N/A",
TotalLevel: 0,
TotalLevel: Level, // Use the original Level directly
PrioColors: new Set(),
PrioNames: new Set(),
Messages: [],
};
}
// Aggregiere die Level und sammle Prioritätsinformationen und Nachrichten
acc[IdLD][Modul].TotalLevel += Level;
// Speichere die Prioritätsinformationen und Nachrichten
acc[IdLD][Modul].PrioColors.add(PrioColor);
acc[IdLD][Modul].PrioNames.add(PrioName);
if (Message && Message !== "?") {
@@ -125,12 +125,12 @@ function logGroupedData(statisList) {
const formattedData = {};
Object.entries(grouped).forEach(([stationId, modules]) => {
const filteredModules = Object.entries(modules)
.filter(([modulId, data]) => data.ModulName !== "?")
.filter(([modulId, data]) => data.ModulName !== "?") // Filter out modules without names
.map(([modulId, data]) => ({
Modul: modulId,
ModulName: data.ModulName,
ModulTyp: data.ModulTyp,
TotalLevel: data.TotalLevel,
Level: data.TotalLevel, // Use the original Level
PrioColors: Array.from(data.PrioColors).join(", "),
PrioNames: Array.from(data.PrioNames).join(", "),
Messages: data.Messages.join(" | "),