modules/admin-full: fix JavaScript issues in live statistics
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 14 Oct 2011 13:33:47 +0000 (13:33 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 14 Oct 2011 13:33:47 +0000 (13:33 +0000)
modules/admin-full/luasrc/view/admin_status/bandwidth.htm
modules/admin-full/luasrc/view/admin_status/wireless.htm

index da683737064a7ef6185ae12ab43b80465d4ddfd2..b8a21bd33c6683d1c0d765a1efed9a4c02abd226 100644 (file)
@@ -188,11 +188,14 @@ $Id$
                                                                continue;
 
                                                        /* normalize difference against time interval */
-                                                       var time_delta = data[i][TIME] - data[i-1][TIME];
-                                                       if (time_delta)
+                                                       if (i > 0)
+                                                       {
+                                                               var time_delta = data[i][TIME] - data[i-1][TIME];
+                                                               if (time_delta)
                                                        {
-                                                               data_rx.push((data[i][RXB] - data[i-1][RXB]) / time_delta);
-                                                               data_tx.push((data[i][TXB] - data[i-1][TXB]) / time_delta);
+                                                                       data_rx.push((data[i][RXB] - data[i-1][RXB]) / time_delta);
+                                                                       data_tx.push((data[i][TXB] - data[i-1][TXB]) / time_delta);
+                                                               }
                                                        }
                                                }
 
index eb91ae649ffa45fca135aa690e3f08466f806420..f70e3b26fc758bac519297480f6f05694c1588f5 100644 (file)
@@ -213,7 +213,7 @@ $Id$
 
                                                        data_rssi.push(data[i][RSSI] - noise_floor);
                                                        data_noise.push(data[i][NOISE] - noise_floor);
-                                                       data_rate.push(Math.floor(data[i][RATE] / 100));
+                                                       data_rate.push(Math.floor(data[i][RATE] / 1000));
                                                }
 
                                                /* cut off outdated entries */