From 3490d9460c8a03f4b8e2dbf63109306381e04a05 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Sat, 20 Nov 2021 22:03:58 +0100 Subject: [PATCH] ui: traffic-control edit: very simple duplicate timeframe detection Signed-off-by: Thomas Lamprecht --- www/window/TrafficControlEdit.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/www/window/TrafficControlEdit.js b/www/window/TrafficControlEdit.js index 2fdb470f..ced947a4 100644 --- a/www/window/TrafficControlEdit.js +++ b/www/window/TrafficControlEdit.js @@ -203,7 +203,14 @@ Ext.define('PBS.window.TrafficControlEdit', { delete values.timeframe; } if (values.timeframe && !Ext.isArray(values.timeframe)) { - values.timeframe = values.timeframe.split(';'); + let timeframe = [], seen = {}; + values.timeframe.split(';').forEach(tf => { + if (!seen[tf]) { + timeframe.push(tf); + seen[tf] = true; + } + }); + values.timeframe = timeframe; } delete values['network-select'];