v2 autoremove finisched alerts

This commit is contained in:
2018-12-18 00:38:26 +01:00
parent 31116a7cae
commit e4ccac9966
3 changed files with 84 additions and 38 deletions

View File

@@ -884,17 +884,40 @@ class AutomaticDispose {
ReadAndAddMissions(MissionID, Runner) {
const self = this;
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions, self.ADisDB.ADisAvailabelMissions], () => {
if (typeof MissionID != 'undefined') {
return self.AddMission(MissionID, Runner);
} else {
return self.ADisSettings.runner_divs.forEach(async (RunnerX, index) => {
await $("#" + RunnerX).find(".missionSideBarEntry").each(async (index, elem) => {
MissionID = $(elem).attr("mission_id");
await self.AddMission(MissionID, RunnerX);
self.ADSettings().then(() => {
return self.ADisDB.ADisMissions.toCollection()
}).then((Missions) => {
if (typeof Missions !== "undefined") {
return Missions.count((count) => {
if (count > 0) {
return Missions.each((MyMission) => {
var MissionElement = $("#mission_" + MyMission.missionID);
if (MissionElement.length == 0 || $('#mission_panel_' + MyMission.missionID).hasClass('mission_panel_green')) {
// remove
console.log("Remove :", MyMission)
self.RemoveMissionsFromQueue(MyMission.missionID)
}
});
}
});
})
}
}
}).then(() => {
if (typeof MissionID != 'undefined') {
return self.AddMission(MissionID, Runner);
} else {
return self.ADisSettings.runner_divs.forEach(async (RunnerX, index) => {
await $("#" + RunnerX).find(".missionSideBarEntry").each(async (index, elem) => {
MissionID = $(elem).attr("mission_id");
await self.AddMission(MissionID, RunnerX);
});
})
}
});
});
}
@@ -976,7 +999,7 @@ class AutomaticDispose {
});
} else {
var MissionElement = $("#mission_" + ID);
var MissionID = MissionElement.attr("mission_id");
@@ -1343,37 +1366,37 @@ class AutomaticDispose {
}).then(async () => {
return await self.CollectInvolvedVehicles();
}).then(async () => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0){
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return await self.CollectPatients();
})
.then(async () => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0){
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return await self.ProcessEmergencyMedicalService()
})
.then(async () => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0){
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return await self.ProcessFireDepartment()
})
.then(async () => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0){
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return await self.ProcessPoliceDepartment()
})
.then(async () => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0){
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return await self.ProcessTechnicalEmergencyService()
})
.then(async () => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0){
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return await self.ProcessWaterRescue()
@@ -1398,7 +1421,7 @@ class AutomaticDispose {
})
};
var $div = $("#mission-form > div:nth-child(7) > a");
var isShow = $div.is(':hidden');
//console.log($div, isShow);
@@ -1422,7 +1445,7 @@ class AutomaticDispose {
alarming(self)
}, 250);
}
}