From 67be7d8c9e7682114fc43dc88244c9374046ea47 Mon Sep 17 00:00:00 2001 From: Isaac Vidal Daza Date: Mon, 28 Sep 2020 11:32:26 +0200 Subject: #1006 Fix RemotePC IP retrieving on running clients Error in the REST API response of /ous/:id1/labs/:id2/clients/status that returns the status of the computers in a classroom. It returns running PCs with an X.X.X.1 and X.X.X.2 IP address instead of those that are actually running, which are X.X.X.15 and X.X.X.16. The error cause is, when constructing the JSON response, a foreach that ignores the "keys" of the response array. This commit adds the "keys" to the foreach to iterate also through them. --- admin/WebConsole/rest/server.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/WebConsole/rest/server.php b/admin/WebConsole/rest/server.php index c7c153ad..a6256a2e 100644 --- a/admin/WebConsole/rest/server.php +++ b/admin/WebConsole/rest/server.php @@ -143,10 +143,10 @@ EOD; } // Parse responses. reset($urls); - foreach ($result as $res) { + foreach ($result as $myKey => $res) { if (!empty($res['data'])) { // Get status and session data. - $ip = key($urls); + $ip = $myKey; $data = json_decode($res['data']); if (@isset($status[$data->status])) { $stat[$ip] = $status[$data->status]; -- cgit v1.2.3-18-g5258