From 277126a816673f333ef849351ac20059e34df26c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=A4fliger?= Date: Mon, 18 Nov 2024 14:10:42 +0100 Subject: [PATCH] =?UTF-8?q?fehler=20bei=20unterschiedlichen=20priorit?= =?UTF-8?q?=C3=A4ten=20behoben?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manager/module.php | 10 +++++++++- library.json | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Manager/module.php b/Manager/module.php index d5e4d1f..fd1130e 100644 --- a/Manager/module.php +++ b/Manager/module.php @@ -139,8 +139,16 @@ class Manager extends IPSModule $priorityKey = $getCurrentDataParam ? 'LockPrio' : 'UserPrio'; // Schleife durch alle Prioritäten - $priorities = array_unique(array_column($filteredEnergyUsers, $priorityKey)); + $groupedUsers = []; + foreach ($priorities as $priority) { + $groupedUsers[$priority] = array_filter($filteredEnergyUsers, function ($user) use ($priority, $priorityKey) { + return $user[$priorityKey] == $priority; + }); + } + + // Jetzt kannst du die Benutzer gruppenweise verarbeiten + foreach ($groupedUsers as $priority => $users) { // EnergyUser mit gleicher Priorität sammeln $samePriorityUsers = array_filter($filteredEnergyUsers, function ($user) use ($priority, $priorityKey) { return $user[$priorityKey] == $priority; diff --git a/library.json b/library.json index 9feb1e8..b8f5672 100644 --- a/library.json +++ b/library.json @@ -6,7 +6,7 @@ "compatibility": { "version": "7.1" }, - "version": "0.142", + "version": "0.143", "build": 0, "date": 0 } \ No newline at end of file