]> nos-oignons.net Git - website.git/commitdiff
Correction du filtrage de relays incorrects
authorjvoisin <julien.voisin@dustri.org>
Mon, 28 Aug 2023 21:02:15 +0000 (23:02 +0200)
committerjvoisin <julien.voisin@dustri.org>
Mon, 28 Aug 2023 21:02:15 +0000 (23:02 +0200)
Voir https://stackoverflow.com/questions/21811630/splicing-a-javascript-array-from-within-the-callback-passed-to-foreach

assets/bw_graphs.js

index 3efacbbb8559edad9e5352fe9abe3b5cc2e66f43..dbeb1cfb155a95cac324fd66a25f171a806cc638 100644 (file)
@@ -62,12 +62,11 @@ BwDrawer.color.range(nos_oignons_relays.map(function(r) {return r.color}));
 
 BwDrawer.draw_bandwidth_graph = function(raw_data, selector, period) {
   // Purge non running relays
-  raw_data.relays.forEach(function(r, i) {
-    if (typeof r.read_history === 'undefined' || typeof r.write_history === 'undefined') {
-      raw_data.relays.splice(i, 1);
-    }
+  raw_data.relays = raw_data.relays.filter(function(relay) {
+    return typeof r.read_history === 'undefined' || typeof r.write_history === 'undefined';
   });
 
+
   var update_period;
 
   var svg = d3.select(selector).append("svg")