From 29c2c73e14d90cfa803b21765c1dc6dc8a7252ad Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Wed, 19 May 2021 09:31:13 +0200 Subject: #995 Fix client speed view inside a room Before, speed information was not shown in the corresponding computer, but from first to last element in the table, this did not take into account for shutdown computers or the position inside the room for a given computer. This fix maps ips to speed information so it can later be indexed to show information correctly. Fixes: 8634dd3 (#995 Show client link speed if available) --- admin/WebConsole/principal/aula.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'admin/WebConsole') diff --git a/admin/WebConsole/principal/aula.php b/admin/WebConsole/principal/aula.php index dedb01b8..9706e5b2 100644 --- a/admin/WebConsole/principal/aula.php +++ b/admin/WebConsole/principal/aula.php @@ -290,11 +290,16 @@ function pintaordenadores(){ global $map; global $max_col; - $clients = clients_v2(2, $Mip); - $get_speed = function($cli) { + $clients = clients_v2(2, $Mip)['clients']; + $addr_clients = function($cli) { + return $cli['addr']; + }; + $speed_clients = function($cli) { return $cli['speed'] ? $cli['speed'] : '-1'; }; - $speeds = array_map($get_speed, $clients['clients']); + $clients_speed = array_map($speed_clients, $clients); + $clients_addr = array_map($addr_clients, $clients); + $addr_speed_map = array_combine($clients_addr, $clients_speed); $ntr=0; // Numero de ordenadores por fila if ($nombreaula!=""){ @@ -324,11 +329,10 @@ function pintaordenadores(){ echo '
'; echo ' '.$Mmac[$i].''; echo '
'; - if ($speeds[$i] > 0 && $speeds[$i] < 1000) { - echo ' '.$speeds[$i].' Mbit'; - } - if ($speeds[$i] > 0 && $speeds[$i] >= 1000) { - echo ' '.$speeds[$i].' Mbit'; + if ($addr_speed_map[$Mip[$i]] > 0 && $addr_speed_map[$Mip[$i]] >= 1000) { + echo ' '.$addr_speed_map[$Mip[$i]].' Mbit'; + } elseif ($addr_speed_map[$Mip[$i]] > 0 && $addr_speed_map[$Mip[$i]] < 1000) { + echo ' '.$addr_speed_map[$Mip[$i]].' Mbit'; } echo ''; echo ''; -- cgit v1.2.3-18-g5258