v2 transaction

This commit is contained in:
2018-12-19 17:27:30 +01:00
parent fdffe19a11
commit efd95eacab
3 changed files with 42 additions and 42 deletions

View File

@@ -196,7 +196,7 @@ class AutomaticDispose {
RemovePoliceSprechwunschFromQueue(WunschID) {
let self = this;
return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunschPolice], async () => {
return this.ADisDB.ADisSprechwunschPolice.where({
return await this.ADisDB.ADisSprechwunschPolice.where({
missionID: WunschID
}).delete();
@@ -207,7 +207,7 @@ class AutomaticDispose {
RemoveRescueSprechwunschFromQueue(WunschID) {
let self = this;
return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunsch], async () => {
return this.ADisDB.ADisSprechwunsch.where({
return await this.ADisDB.ADisSprechwunsch.where({
vehicleID: WunschID
}).delete();
@@ -251,8 +251,8 @@ class AutomaticDispose {
OpenNextRescueSprechwunsch() {
let self = this;
return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunsch], async () => {
this.ADSettings().then((setting) => {
return await self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunsch], async () => {
return await this.ADSettings().then((setting) => {
if (setting['Sprechwunsch-Automatic'] == 'true') {
return self.ADisDB.ADisSprechwunsch.where({
done: 'false'
@@ -260,9 +260,9 @@ class AutomaticDispose {
}
}).then((Wunsch) => {
if (Wunsch !== undefined) {
Wunsch.each((myWunsch) => {
Wunsch.each(async (myWunsch) => {
let VehicleID = myWunsch.vehicleID;
self.UpdateRescueSprechwunschToDone(VehicleID).then(() => {
await self.UpdateRescueSprechwunschToDone(VehicleID).then(() => {
if ($("#adis-sprechwunsch-rescue-frame").attr("vehicle_id") == "empty") {
$("#adis-sprechwunsch-rescue-frame").attr("src", "https://www.leitstellenspiel.de/vehicles/" + VehicleID);
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", VehicleID);
@@ -287,7 +287,7 @@ class AutomaticDispose {
AddRescueSprechwunschToQueue(WunschID) {
let self = this
return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunsch], async () => {
return self.ADisDB.ADisSprechwunsch.put({
return await self.ADisDB.ADisSprechwunsch.put({
vehicleID: WunschID,
done: 'false'
})
@@ -300,7 +300,7 @@ class AutomaticDispose {
UpdateRescueSprechwunschToDone(WunschID) {
let self = this
return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunsch], async () => {
return self.ADisDB.ADisSprechwunsch.put({
return await self.ADisDB.ADisSprechwunsch.put({
vehicleID: WunschID,
done: 'true'
})
@@ -418,7 +418,7 @@ class AutomaticDispose {
CollectPoliceSprechwuensche() {
let self = this;
return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunschPolice], async () => {
new Promise(async (resolve, reject) => {
await new Promise(async (resolve, reject) => {
await self.ADisDB.ADisSprechwunschPolice.where({
done: 'false'
}).each((myWunsch) => {
@@ -430,14 +430,14 @@ class AutomaticDispose {
return resolve();
}).then(() => {
var MOIODOS = $('div#mission_list div.missionSideBarEntry:visible');
return MOIODOS.each((_, elem) => {
return MOIODOS.each(async (_, elem) => {
if ($(elem).text().match(/Gefangene sollen abtransportiert werden/g)) {
var MissionID = $(elem).attr("mission_id");
self.AddPoliceSprechwunschToQueue(MissionID);
await self.AddPoliceSprechwunschToQueue(MissionID);
}
});
}).then(() => {
$("#building_list").find(".building_list_vehicle_element").each((_, elem) => {
$("#building_list").find(".building_list_vehicle_element").each(async (_, elem) => {
var VehicleStatus = $(elem).find(".building_list_fms").text();
var VehicleType = Number(parseInt($(elem).find("a").attr("vehicle_type_id")));
var VehicleID = $(elem).attr("vehicle_id");
@@ -447,7 +447,7 @@ class AutomaticDispose {
var _meap = String(map2.attr('href'));
var MissionID = _meap.substr(_meap.lastIndexOf("/") + 1);
if (MissionID) {
self.AddPoliceSprechwunschToQueue(MissionID);
await self.AddPoliceSprechwunschToQueue(MissionID);
}
}
}
@@ -461,7 +461,7 @@ class AutomaticDispose {
OpenNextPoliceSprechwunsch() {
let self = this;
return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunschPolice], async () => {
return this.ADSettings().then((setting) => {
return await self.ADSettings().then((setting) => {
if (setting['Sprechwunsch-Automatic'] == 'true') {
return self.ADisDB.ADisSprechwunschPolice.where({
done: 'false'
@@ -469,16 +469,16 @@ class AutomaticDispose {
}
}).then((Wunsch) => {
if (Wunsch !== undefined) {
Wunsch.each((myWunsch) => {
Wunsch.each(async (myWunsch) => {
let MissionID = myWunsch.missionID;
self.UpdatePoliceSprechwunschToDone(MissionID).then(() => {
await self.UpdatePoliceSprechwunschToDone(MissionID).then(() => {
if ($("#adis-sprechwunsch-police-frame").attr("mission_id") == "empty") {
$("#adis-sprechwunsch-police-frame").attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID);
$("#adis-sprechwunsch-police-frame").attr("mission_id", MissionID);
self.PoliceVehicleFrameWatchDog = setTimeout(async function (MissionID) {
let self = this;
self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => {
await self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => {
$("#adis-sprechwunsch-police-frame").attr("src", "");
$("#adis-sprechwunsch-police-frame").attr("mission_id", "empty");
});
@@ -496,7 +496,7 @@ class AutomaticDispose {
AddPoliceSprechwunschToQueue(WunschID) {
let self = this;
return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunschPolice], async () => {
return this.ADisDB.ADisSprechwunschPolice.put({
return await self.ADisDB.ADisSprechwunschPolice.put({
missionID: WunschID,
done: 'false'
})
@@ -508,7 +508,7 @@ class AutomaticDispose {
UpdatePoliceSprechwunschToDone(WunschID) {
let self = this;
return self.ADisDB.transaction('rw', [self.ADisDB.ADisSprechwunschPolice], async () => {
return self.ADisDB.ADisSprechwunschPolice.put({
return await self.ADisDB.ADisSprechwunschPolice.put({
missionID: WunschID,
done: 'true'
})
@@ -678,7 +678,7 @@ class AutomaticDispose {
self.Jails.reverse();
if (self.Jails.length > 0) {
this.Send_Vehicle_To_Jail()
self.Send_Vehicle_To_Jail()
} else {
$("#mission_vehicle_driving tbody, #mission_vehicle_at_mission tbody").find("tr").each((_, elem) => {
var CalledVehicleID = parseInt($(elem).find("a").first().attr("vehicle_type_id"));