fix schedules repeat
parent
f32ed88276
commit
27fff92c7f
|
@ -118,10 +118,11 @@ module.exports = function(s,config,lang,app,io){
|
||||||
var scheduleNames = Object.keys(s.schedules[key])
|
var scheduleNames = Object.keys(s.schedules[key])
|
||||||
scheduleNames.forEach(function(name){
|
scheduleNames.forEach(function(name){
|
||||||
var schedule = s.schedules[key][name]
|
var schedule = s.schedules[key][name]
|
||||||
if(!schedule.active && schedule.enabled === 1 && schedule.start && schedule.details.monitorStates){
|
if(schedule.enabled === 1 && schedule.start && schedule.details.monitorStates){
|
||||||
var timePasses = checkTimeAgainstSchedule(schedule)
|
var timePasses = checkTimeAgainstSchedule(schedule)
|
||||||
var daysPasses = checkDaysAgainstSchedule(schedule)
|
var daysPasses = checkDaysAgainstSchedule(schedule)
|
||||||
if(timePasses && daysPasses){
|
var passed = timePasses && daysPasses
|
||||||
|
if(passed && !schedule.active){
|
||||||
schedule.active = true
|
schedule.active = true
|
||||||
var monitorStates = schedule.details.monitorStates
|
var monitorStates = schedule.details.monitorStates
|
||||||
monitorStates.forEach(function(stateName){
|
monitorStates.forEach(function(stateName){
|
||||||
|
@ -135,7 +136,7 @@ module.exports = function(s,config,lang,app,io){
|
||||||
// console.log(endData)
|
// console.log(endData)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}else{
|
}else if(!passed && schedule.active){
|
||||||
schedule.active = false
|
schedule.active = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue