summaryrefslogtreecommitdiff
path: root/www/js/NVR.js
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2020-01-10 11:01:04 +0530
committerPliable Pixels <pliablepixels@gmail.com>2020-01-10 11:01:04 +0530
commit956b2f1fbbd585df40e644cc743260c55976ae41 (patch)
tree059f39f0200d1df4c507d85abe5893dd17142979 /www/js/NVR.js
parentaca906d483d8d0e8a50b1c70b665f925d8c3bba7 (diff)
#881 if we find duplicate monitors filter them out
Diffstat (limited to 'www/js/NVR.js')
-rw-r--r--www/js/NVR.js16
1 files changed, 15 insertions, 1 deletions
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());