From 956b2f1fbbd585df40e644cc743260c55976ae41 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Fri, 10 Jan 2020 11:01:04 +0530 Subject: #881 if we find duplicate monitors filter them out --- www/js/NVR.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'www/js/NVR.js') diff --git a/www/js/NVR.js b/www/js/NVR.js index 57821085..8d9681c8 100644 --- a/www/js/NVR.js +++ b/www/js/NVR.js @@ -2765,7 +2765,21 @@ angular.module('zmApp.controllers') data = data.data; if (data.monitors) monitors = data.monitors; - + // Now let's make sure we remove repeating monitors + // may happen in groups case + + debug ("Before duplicate processing, we have: "+monitors.length+" monitors"); + //console.log (JSON.stringify(monitors)); + var monitorHash = {}; + for (var mo in monitors) { + monitorHash[monitors[mo].Monitor.Id] = monitors[mo]; + } + monitors = []; + for (mo in monitorHash) { + monitors.push(monitorHash[mo]); + } + debug ("After duplicate processing, we have: "+monitors.length+" monitors"); + //console.log (JSON.stringify(monitors)); if ($rootScope.authSession == '') { log("Now that we have monitors, lets get AuthKey..."); getAuthKey(monitors[0].Monitor.Id, (Math.floor((Math.random() * 999999) + 1)).toString()); -- cgit v1.2.3