fix checking matrix in region

merge-requests/180/merge
Moe Alam 2021-02-27 08:39:17 -08:00
parent 876b4c4d45
commit 1ef74e5201
2 changed files with 7 additions and 6 deletions

View File

@ -733,6 +733,7 @@
"libx264": "libx264", "libx264": "libx264",
"libx265": "libx265", "libx265": "libx265",
"copy": "copy", "copy": "copy",
"Duplicate": "Duplicate",
"Audio": "Audio", "Audio": "Audio",
"Mute Audio": "Mute Audio", "Mute Audio": "Mute Audio",
"No Audio": "No Audio", "No Audio": "No Audio",

View File

@ -126,8 +126,8 @@ module.exports = (s,config,lang,app,io) => {
const getEventsCounted = (groupKey,monitorId) => { const getEventsCounted = (groupKey,monitorId) => {
return s.group[eventData.ke].activeMonitors[eventData.id].detector_motion_count.length return s.group[eventData.ke].activeMonitors[eventData.id].detector_motion_count.length
} }
const hasMatrices = (monitorDetails) => { const hasMatrices = (eventDetails) => {
return (monitorDetails.matrices && monitorDetails.matrices.length > 0) return (eventDetails.matrices && eventDetails.matrices.length > 0)
} }
const checkEventFilters = (d,monitorDetails,filter) => { const checkEventFilters = (d,monitorDetails,filter) => {
const eventDetails = d.details const eventDetails = d.details
@ -246,7 +246,7 @@ module.exports = (s,config,lang,app,io) => {
}) })
if(d.details.matrices && d.details.matrices.length === 0 || filter.halt === true){ if(d.details.matrices && d.details.matrices.length === 0 || filter.halt === true){
return false return false
}else if(hasMatrices(monitorDetails)){ }else if(hasMatrices(d.details)){
var reviewedMatrix = [] var reviewedMatrix = []
d.details.matrices.forEach(function(matrix){ d.details.matrices.forEach(function(matrix){
if(matrix)reviewedMatrix.push(matrix) if(matrix)reviewedMatrix.push(matrix)
@ -299,9 +299,9 @@ module.exports = (s,config,lang,app,io) => {
} }
}) })
} }
const checkForObjectsInRegions = (monitorConfig,filter,d,didCountingAlready) => { const checkForObjectsInRegions = (monitorConfig,eventDetails,filter,d,didCountingAlready) => {
const monitorDetails = monitorConfig.details const monitorDetails = monitorConfig.details
if(hasMatrices(monitorDetails) && monitorDetails.detector_obj_region === '1'){ if(hasMatrices(eventDetails) && monitorDetails.detector_obj_region === '1'){
var regions = s.group[monitorConfig.ke].activeMonitors[monitorConfig.mid].parsedObjects.cords var regions = s.group[monitorConfig.ke].activeMonitors[monitorConfig.mid].parsedObjects.cords
var isMatrixInRegions = isAtleastOneMatrixInRegion(regions,eventDetails.matrices) var isMatrixInRegions = isAtleastOneMatrixInRegion(regions,eventDetails.matrices)
if(isMatrixInRegions){ if(isMatrixInRegions){
@ -554,7 +554,7 @@ module.exports = (s,config,lang,app,io) => {
const passedMotionLock = checkMotionLock(d,monitorDetails) const passedMotionLock = checkMotionLock(d,monitorDetails)
if(!passedMotionLock)return if(!passedMotionLock)return
} }
const passedObjectInRegionCheck = checkForObjectsInRegions(monitorConfig,filter,d,didCountingAlready) const passedObjectInRegionCheck = checkForObjectsInRegions(monitorConfig,eventDetails,filter,d,didCountingAlready)
if(!passedObjectInRegionCheck)return if(!passedObjectInRegionCheck)return
// //