From f58962ab032acf13685b66923148beb408f6117c Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 28 Aug 2023 23:02:15 +0200 Subject: [PATCH] Correction du filtrage de relays incorrects Voir https://stackoverflow.com/questions/21811630/splicing-a-javascript-array-from-within-the-callback-passed-to-foreach --- assets/bw_graphs.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/assets/bw_graphs.js b/assets/bw_graphs.js index 3efacbb..dbeb1cf 100644 --- a/assets/bw_graphs.js +++ b/assets/bw_graphs.js @@ -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") -- 2.39.5