fix how unlocked incident fees are applied
This commit is contained in:
@@ -238,7 +238,7 @@ const analyseReservation = (reservation) => {
|
|||||||
const previousReservationEnd = moment.utc(previousReservation.end);
|
const previousReservationEnd = moment.utc(previousReservation.end);
|
||||||
timeDifferenceFromPreviousReservation = currentReservationStart.diff(previousReservationEnd, 'minutes');
|
timeDifferenceFromPreviousReservation = currentReservationStart.diff(previousReservationEnd, 'minutes');
|
||||||
}
|
}
|
||||||
const previousReservationIsBackToBack = timeDifferenceFromPreviousReservation < MAX_BACK_TO_BACK_DIFFERENCE;
|
const previousReservationIsBackToBack = timeDifferenceFromPreviousReservation <= MAX_BACK_TO_BACK_DIFFERENCE;
|
||||||
|
|
||||||
|
|
||||||
let timeDifferenceBeforeNextReservation = MAX_BACK_TO_BACK_DIFFERENCE + 100;
|
let timeDifferenceBeforeNextReservation = MAX_BACK_TO_BACK_DIFFERENCE + 100;
|
||||||
@@ -246,7 +246,7 @@ const analyseReservation = (reservation) => {
|
|||||||
const nextReservationStart = moment.utc(nextReservation.start);
|
const nextReservationStart = moment.utc(nextReservation.start);
|
||||||
timeDifferenceBeforeNextReservation = nextReservationStart.diff(currentReservationEnd, 'minutes');
|
timeDifferenceBeforeNextReservation = nextReservationStart.diff(currentReservationEnd, 'minutes');
|
||||||
}
|
}
|
||||||
const nextReservationIsBackToBack = timeDifferenceBeforeNextReservation < MAX_BACK_TO_BACK_DIFFERENCE;
|
const nextReservationIsBackToBack = timeDifferenceBeforeNextReservation <= MAX_BACK_TO_BACK_DIFFERENCE;
|
||||||
|
|
||||||
let timeDifferenceFromUnlockEntry = 0;
|
let timeDifferenceFromUnlockEntry = 0;
|
||||||
if (unlockEntry) {
|
if (unlockEntry) {
|
||||||
@@ -406,12 +406,16 @@ const getIncidentData = (reservation) => {
|
|||||||
//**********************
|
//**********************
|
||||||
|
|
||||||
// 1. Check if member entered before reservation start time
|
// 1. Check if member entered before reservation start time
|
||||||
// console.log('\r\n\r\nChecking if member entered before reservation start time :');
|
// if (currentReservation.memberId === '5ce785af422bdd00967fb781' && reservationMoment.isAfter('2019-12-01 00:00:16+00')) {
|
||||||
// console.log('\tunlockEntry : ', unlockEntry && unlockEntry.timestamp ? unlockEntry.timestamp : 'NO UNLOCK ENTRY');
|
// console.log('\r\n\r\nChecking if member entered before reservation start time :');
|
||||||
// console.log('\tCharge before : ', chargeBefore);
|
// console.log('\tunlockEntry : ', unlockEntry && unlockEntry.timestamp ? unlockEntry.timestamp : 'NO UNLOCK ENTRY');
|
||||||
// console.log('\tThere is prev. res : ', previousReservationIsBackToBack);
|
// console.log('\tCharge before : ', chargeBefore);
|
||||||
|
// console.log('\tThere is prev. res : ', previousReservationIsBackToBack);
|
||||||
|
// }
|
||||||
if (unlockEntry && chargeBefore && !previousReservationIsBackToBack) {
|
if (unlockEntry && chargeBefore && !previousReservationIsBackToBack) {
|
||||||
// console.log('\tIncident : YES');
|
// if (currentReservation.memberId === '5ce785af422bdd00967fb781' && reservationMoment.isAfter('2019-12-01 00:00:16+00')) {
|
||||||
|
// console.log('\tIncident : YES');
|
||||||
|
// }
|
||||||
incidents.push({
|
incidents.push({
|
||||||
incidentType: incidentType.UNSCHEDULED_INCIDENT_BEFORE_RESERVATION,
|
incidentType: incidentType.UNSCHEDULED_INCIDENT_BEFORE_RESERVATION,
|
||||||
reservation,
|
reservation,
|
||||||
@@ -424,16 +428,22 @@ const getIncidentData = (reservation) => {
|
|||||||
totalChargeFee: totalChargeFeeBefore,
|
totalChargeFee: totalChargeFeeBefore,
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
// console.log('\tIncident : NO');
|
// if (currentReservation.memberId === '5ce785af422bdd00967fb781' && reservationMoment.isAfter('2019-12-01 00:00:16+00')) {
|
||||||
|
// console.log('\tIncident : NO');
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Check if member left after reservation end time
|
// 2. Check if member left after reservation end time
|
||||||
// console.log('\r\n\r\nChecking if member left after reservation end time :');
|
// if (currentReservation.memberId === '5ce785af422bdd00967fb781' && reservationMoment.isAfter('2019-12-01 00:00:16+00')) {
|
||||||
// console.log('\tlockEntry : ', lockEntry && lockEntry.timestamp ? lockEntry.timestamp : 'NO LOCK ENTRY');
|
// console.log('\r\n\r\nChecking if member left after reservation end time :');
|
||||||
// console.log('\tCharge after : ', chargeAfter);
|
// console.log('\tlockEntry : ', lockEntry && lockEntry.timestamp ? lockEntry.timestamp : 'NO LOCK ENTRY');
|
||||||
// console.log('\tThere is res after : ', nextReservationIsBackToBack);
|
// console.log('\tCharge after : ', chargeAfter);
|
||||||
|
// console.log('\tThere is res after : ', nextReservationIsBackToBack);
|
||||||
|
// }
|
||||||
if (lockEntry && chargeAfter && !nextReservationIsBackToBack) {
|
if (lockEntry && chargeAfter && !nextReservationIsBackToBack) {
|
||||||
// console.log('\tIncident : YES');
|
// if (currentReservation.memberId === '5ce785af422bdd00967fb781' && reservationMoment.isAfter('2019-12-01 00:00:16+00')) {
|
||||||
|
// console.log('\tIncident : YES');
|
||||||
|
// }
|
||||||
incidents.push({
|
incidents.push({
|
||||||
incidentType: incidentType.UNSCHEDULED_INCIDENT_AFTER_RESERVATION,
|
incidentType: incidentType.UNSCHEDULED_INCIDENT_AFTER_RESERVATION,
|
||||||
reservation,
|
reservation,
|
||||||
@@ -446,15 +456,19 @@ const getIncidentData = (reservation) => {
|
|||||||
totalChargeFee: totalChargeFeeAfter,
|
totalChargeFee: totalChargeFeeAfter,
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
// console.log('\tIncident : NO');
|
// if (currentReservation.memberId === '5ce785af422bdd00967fb781' && reservationMoment.isAfter('2019-12-01 00:00:16+00')) {
|
||||||
|
// console.log('\tIncident : NO');
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Check if member forgot to lock the door
|
// 3. Check if member forgot to lock the door
|
||||||
// console.log('\r\n\r\nChecking if member left unlocked door :');
|
// if (currentReservation.memberId === '5ce785af422bdd00967fb781' && reservationMoment.isAfter('2019-12-01 00:00:16+00')) {
|
||||||
// console.log('\tunlockEntry : ', unlockEntry && unlockEntry.timestamp ? unlockEntry.timestamp : 'NO UNLOCK ENTRY');
|
// console.log('\r\n\r\nChecking if member left unlocked door :');
|
||||||
// console.log('\tlockEntry : ', lockEntry && lockEntry.timestamp ? lockEntry.timestamp : 'NO LOCK ENTRY');
|
// console.log('\tunlockEntry : ', unlockEntry && unlockEntry.timestamp ? unlockEntry.timestamp : 'NO UNLOCK ENTRY');
|
||||||
// console.log('\tThere is res before: ', previousReservationIsBackToBack);
|
// console.log('\tlockEntry : ', lockEntry && lockEntry.timestamp ? lockEntry.timestamp : 'NO LOCK ENTRY');
|
||||||
// console.log('\tThere is res after : ', nextReservationIsBackToBack);
|
// console.log('\tThere is res before: ', previousReservationIsBackToBack);
|
||||||
|
// console.log('\tThere is res after : ', nextReservationIsBackToBack);
|
||||||
|
// }
|
||||||
let forgotToLockAsyncCheck;
|
let forgotToLockAsyncCheck;
|
||||||
if (!lockEntry && !nextReservationIsBackToBack){
|
if (!lockEntry && !nextReservationIsBackToBack){
|
||||||
const emptyReservation = {
|
const emptyReservation = {
|
||||||
@@ -464,7 +478,9 @@ const getIncidentData = (reservation) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (unlockEntry){
|
if (unlockEntry){
|
||||||
// console.log('\tIncident : YES [#1]');
|
// if (currentReservation.memberId === '5ce785af422bdd00967fb781' && reservationMoment.isAfter('2019-12-01 00:00:16+00')) {
|
||||||
|
// console.log('\tIncident : YES [#1]');
|
||||||
|
// }
|
||||||
incidents.push({
|
incidents.push({
|
||||||
incidentType: incidentType.UNLOCKED_INCIDENT_RELATED_WITH_RESERVATION,
|
incidentType: incidentType.UNLOCKED_INCIDENT_RELATED_WITH_RESERVATION,
|
||||||
unlockTimestamp: unlockEntry.timestamp,
|
unlockTimestamp: unlockEntry.timestamp,
|
||||||
@@ -488,7 +504,9 @@ const getIncidentData = (reservation) => {
|
|||||||
forgotToLockAsyncCheck
|
forgotToLockAsyncCheck
|
||||||
.then((lastEntry) => {
|
.then((lastEntry) => {
|
||||||
if (lastEntry && lastEntry.event === doorLockEvents.USER_UNLOCKED){
|
if (lastEntry && lastEntry.event === doorLockEvents.USER_UNLOCKED){
|
||||||
// console.log('\tIncident : YES [#2]');
|
// if (currentReservation.memberId === '5ce785af422bdd00967fb781' && reservationMoment.isAfter('2019-12-01 00:00:16+00')) {
|
||||||
|
// console.log('\tIncident : YES [#2]');
|
||||||
|
// }
|
||||||
incidents.push({
|
incidents.push({
|
||||||
incidentType: incidentType.UNLOCKED_INCIDENT_RELATED_WITH_RESERVATION,
|
incidentType: incidentType.UNLOCKED_INCIDENT_RELATED_WITH_RESERVATION,
|
||||||
unlockTimestamp: lastEntry.timestamp,
|
unlockTimestamp: lastEntry.timestamp,
|
||||||
@@ -531,96 +549,55 @@ const getIncidentData = (reservation) => {
|
|||||||
unlockEntry.timestamp : reservation.start;
|
unlockEntry.timestamp : reservation.start;
|
||||||
}
|
}
|
||||||
|
|
||||||
getEntriesBetween(fromTimestamp, toTimestamp, resourceId)
|
// Let's skip this if previous reservation is back-to-back
|
||||||
.then((entriesBetween) => {
|
let getEntriesAsyncCheck;
|
||||||
// const reservationMoment = moment.tz(currentReservation.start, currentReservation.timezone);
|
if (previousReservation && previousReservationIsBackToBack){
|
||||||
// if (currentReservation.memberId === '5ce785af422bdd00967fb781' && reservationMoment.isAfter('2019-11-23 00:00:16+00')) {
|
//Skip
|
||||||
// console.log('\r\n\r\n==== ANALYSE RESERVATION [GET INCIDENT DATA] ==== ');
|
}else{
|
||||||
// console.log('\tStart : ', reservationMoment.format('DD.MM, HH:mm'));
|
getEntriesAsyncCheck = getEntriesBetween(fromTimestamp, toTimestamp, resourceId);
|
||||||
// console.log('\tEnd : ', moment.tz(currentReservation.end, currentReservation.timezone).format('DD.MM, HH:mm'));
|
getEntriesAsyncCheck
|
||||||
// console.log('\t----------------------------------');
|
.then((entriesBetween) => {
|
||||||
// console.log('\tFirst previous reservation : is back to back [', previousReservationIsBackToBack ? 'T' : 'F', ']');
|
// const reservationMoment = moment.tz(currentReservation.start, currentReservation.timezone);
|
||||||
// if (previousReservation) {
|
// if (currentReservation.memberId === '5ce785af422bdd00967fb781' && reservationMoment.isAfter('2019-11-23 00:00:16+00')) {
|
||||||
// console.log('\t\tStart : ', moment.tz(previousReservation.start, previousReservation.timezone).format('DD.MM, HH:mm'));
|
// console.log('\r\n\r\n==== ANALYSE RESERVATION [GET INCIDENT DATA] ==== ');
|
||||||
// console.log('\t\tEnd : ', moment.tz(previousReservation.end, previousReservation.timezone).format('DD.MM, HH:mm'));
|
// console.log('\tStart : ', reservationMoment.format('DD.MM, HH:mm'));
|
||||||
// } else {
|
// console.log('\tEnd : ', moment.tz(currentReservation.end, currentReservation.timezone).format('DD.MM, HH:mm'));
|
||||||
// console.log('\t\tNO PREVIOUS RESERVATION');
|
// console.log('\t----------------------------------');
|
||||||
// }
|
// console.log('\tFirst previous reservation : is back to back [', previousReservationIsBackToBack ? 'T' : 'F', ']');
|
||||||
//
|
// if (previousReservation) {
|
||||||
// console.log('\tFirst next reservation : is back to back [', nextReservationIsBackToBack ? 'T' : 'F', ']');
|
// console.log('\t\tStart : ', moment.tz(previousReservation.start, previousReservation.timezone).format('DD.MM, HH:mm'));
|
||||||
// if (nextReservation) {
|
// console.log('\t\tEnd : ', moment.tz(previousReservation.end, previousReservation.timezone).format('DD.MM, HH:mm'));
|
||||||
// console.log('\t\tStart : ', moment.tz(nextReservation.start, nextReservation.timezone).format('DD.MM, HH:mm'));
|
// } else {
|
||||||
// console.log('\t\tEnd : ', moment.tz(nextReservation.end, nextReservation.timezone).format('DD.MM, HH:mm'));
|
// console.log('\t\tNO PREVIOUS RESERVATION');
|
||||||
// } else {
|
// }
|
||||||
// console.log('\t\tNO NEXT RESERVATION');
|
//
|
||||||
// }
|
// console.log('\tFirst next reservation : is back to back [', nextReservationIsBackToBack ? 'T' : 'F', ']');
|
||||||
//
|
// if (nextReservation) {
|
||||||
// console.log('\t--------------------');
|
// console.log('\t\tStart : ', moment.tz(nextReservation.start, nextReservation.timezone).format('DD.MM, HH:mm'));
|
||||||
//
|
// console.log('\t\tEnd : ', moment.tz(nextReservation.end, nextReservation.timezone).format('DD.MM, HH:mm'));
|
||||||
// console.log('\tFrom timestamp : ', fromTimestamp ? moment.tz(fromTimestamp, UI_TIMEZONE).format('DD.MM, HH:mm') : '-');
|
// } else {
|
||||||
// console.log('\tTo timestamp : ', toTimestamp ? moment.tz(toTimestamp, UI_TIMEZONE).format('DD.MM, HH:mm') : '-');
|
// console.log('\t\tNO NEXT RESERVATION');
|
||||||
// console.log('\t--------------------');
|
// }
|
||||||
// }
|
//
|
||||||
|
// console.log('\t--------------------');
|
||||||
|
//
|
||||||
|
// console.log('\tFrom timestamp : ', fromTimestamp ? moment.tz(fromTimestamp, UI_TIMEZONE).format('DD.MM, HH:mm') : '-');
|
||||||
|
// console.log('\tTo timestamp : ', toTimestamp ? moment.tz(toTimestamp, UI_TIMEZONE).format('DD.MM, HH:mm') : '-');
|
||||||
|
// console.log('\t--------------------');
|
||||||
|
// }
|
||||||
|
|
||||||
let pairUnlockEntry = null;
|
let pairUnlockEntry = null;
|
||||||
let pairLockEntry = null;
|
let pairLockEntry = null;
|
||||||
|
|
||||||
//Inspect all entries and insert detected incidents
|
//Inspect all entries and insert detected incidents
|
||||||
entriesBetween.forEach((entry) => {
|
entriesBetween.forEach((entry) => {
|
||||||
// console.log('\tEvent : ', entry.event);
|
// console.log('\tEvent : ', entry.event);
|
||||||
// console.log('\tEvent : ', entry.timestamp ? moment.tz(entry.timestamp, UI_TIMEZONE).format('DD.MM, HH:mm') : '-');
|
// console.log('\tEvent : ', entry.timestamp ? moment.tz(entry.timestamp, UI_TIMEZONE).format('DD.MM, HH:mm') : '-');
|
||||||
if (entry && entry.event){
|
if (entry && entry.event){
|
||||||
switch(entry.event){
|
switch(entry.event){
|
||||||
case doorLockEvents.USER_UNLOCKED:
|
case doorLockEvents.USER_UNLOCKED:
|
||||||
if (!pairUnlockEntry){
|
if (!pairUnlockEntry){
|
||||||
pairUnlockEntry = entry;
|
pairUnlockEntry = entry;
|
||||||
}else{
|
|
||||||
const emptyReservation = {
|
|
||||||
reservationId: null,
|
|
||||||
start: null,
|
|
||||||
end: null,
|
|
||||||
};
|
|
||||||
|
|
||||||
incidents.push({
|
|
||||||
incidentType: incidentType.UNLOCKED_INCIDENT_STANDALONE,
|
|
||||||
reservation: emptyReservation,
|
|
||||||
unlockTimestamp: pairUnlockEntry.timestamp,
|
|
||||||
memberId: pairUnlockEntry.memberId,
|
|
||||||
resourceId,
|
|
||||||
});
|
|
||||||
|
|
||||||
pairLockEntry = null;
|
|
||||||
pairUnlockEntry = entry;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case doorLockEvents.USER_LOCKED:
|
|
||||||
if (pairUnlockEntry && !pairLockEntry){
|
|
||||||
pairLockEntry = entry;
|
|
||||||
const emptyReservation = {
|
|
||||||
reservationId: null,
|
|
||||||
start: null,
|
|
||||||
end: null,
|
|
||||||
};
|
|
||||||
const unlockMoment = moment.utc(pairUnlockEntry.timestamp);
|
|
||||||
const lockMoment = moment.utc(pairLockEntry.timestamp);
|
|
||||||
|
|
||||||
if (lockMoment.tz(UI_TIMEZONE).isSame(unlockMoment.tz(UI_TIMEZONE), 'day')){
|
|
||||||
const timeDifference = lockMoment.diff(unlockMoment, 'minutes');
|
|
||||||
const timeIntervalsToCharge = Math.floor(timeDifference / UNSCHEDULED_TIME_RESOLUTION);
|
|
||||||
const totalChargeFee = timeIntervalsToCharge * UNSCHEDULED_CHARGE_PRICE;
|
|
||||||
if (timeIntervalsToCharge > 0){
|
|
||||||
incidents.push({
|
|
||||||
incidentType: incidentType.UNSCHEDULED_INCIDENT_STANDALONE,
|
|
||||||
reservation: emptyReservation,
|
|
||||||
unlockTimestamp: pairUnlockEntry.timestamp,
|
|
||||||
lockTimestamp: pairLockEntry.timestamp,
|
|
||||||
memberId: pairUnlockEntry.memberId,
|
|
||||||
resourceId,
|
|
||||||
chargePrice: UNSCHEDULED_CHARGE_PRICE,
|
|
||||||
timeIntervalsToCharge,
|
|
||||||
totalChargeFee,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
const emptyReservation = {
|
const emptyReservation = {
|
||||||
reservationId: null,
|
reservationId: null,
|
||||||
@@ -635,32 +612,105 @@ const getIncidentData = (reservation) => {
|
|||||||
memberId: pairUnlockEntry.memberId,
|
memberId: pairUnlockEntry.memberId,
|
||||||
resourceId,
|
resourceId,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
pairUnlockEntry = null;
|
pairLockEntry = null;
|
||||||
pairLockEntry = null;
|
pairUnlockEntry = entry;
|
||||||
}else{
|
}
|
||||||
if (!pairUnlockEntry){
|
break;
|
||||||
|
case doorLockEvents.USER_LOCKED:
|
||||||
|
if (pairUnlockEntry && !pairLockEntry){
|
||||||
pairLockEntry = entry;
|
pairLockEntry = entry;
|
||||||
//Only lock entry, ignore now
|
const emptyReservation = {
|
||||||
|
reservationId: null,
|
||||||
|
start: null,
|
||||||
|
end: null,
|
||||||
|
};
|
||||||
|
const unlockMoment = moment.utc(pairUnlockEntry.timestamp);
|
||||||
|
const lockMoment = moment.utc(pairLockEntry.timestamp);
|
||||||
|
|
||||||
|
if (lockMoment.tz(UI_TIMEZONE).isSame(unlockMoment.tz(UI_TIMEZONE), 'day')){
|
||||||
|
const timeDifference = lockMoment.diff(unlockMoment, 'minutes');
|
||||||
|
const timeIntervalsToCharge = Math.floor(timeDifference / UNSCHEDULED_TIME_RESOLUTION);
|
||||||
|
const totalChargeFee = timeIntervalsToCharge * UNSCHEDULED_CHARGE_PRICE;
|
||||||
|
if (timeIntervalsToCharge > 0){
|
||||||
|
incidents.push({
|
||||||
|
incidentType: incidentType.UNSCHEDULED_INCIDENT_STANDALONE,
|
||||||
|
reservation: emptyReservation,
|
||||||
|
unlockTimestamp: pairUnlockEntry.timestamp,
|
||||||
|
lockTimestamp: pairLockEntry.timestamp,
|
||||||
|
memberId: pairUnlockEntry.memberId,
|
||||||
|
resourceId,
|
||||||
|
chargePrice: UNSCHEDULED_CHARGE_PRICE,
|
||||||
|
timeIntervalsToCharge,
|
||||||
|
totalChargeFee,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
const emptyReservation = {
|
||||||
|
reservationId: null,
|
||||||
|
start: null,
|
||||||
|
end: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
incidents.push({
|
||||||
|
incidentType: incidentType.UNLOCKED_INCIDENT_STANDALONE,
|
||||||
|
reservation: emptyReservation,
|
||||||
|
unlockTimestamp: pairUnlockEntry.timestamp,
|
||||||
|
memberId: pairUnlockEntry.memberId,
|
||||||
|
resourceId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
pairUnlockEntry = null;
|
||||||
|
pairLockEntry = null;
|
||||||
|
}else{
|
||||||
|
if (!pairUnlockEntry){
|
||||||
|
pairLockEntry = entry;
|
||||||
|
//Only lock entry, ignore now
|
||||||
|
}
|
||||||
|
pairLockEntry = null;
|
||||||
|
pairUnlockEntry = null;
|
||||||
}
|
}
|
||||||
pairLockEntry = null;
|
}
|
||||||
pairUnlockEntry = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (pairUnlockEntry){
|
||||||
|
const emptyReservation = {
|
||||||
|
reservationId: null,
|
||||||
|
start: null,
|
||||||
|
end: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
incidents.push({
|
||||||
|
incidentType: incidentType.UNLOCKED_INCIDENT_STANDALONE,
|
||||||
|
reservation: emptyReservation,
|
||||||
|
unlockTimestamp: pairUnlockEntry.timestamp,
|
||||||
|
memberId: pairUnlockEntry.memberId,
|
||||||
|
resourceId,
|
||||||
|
});
|
||||||
|
|
||||||
|
pairLockEntry = null;
|
||||||
|
pairUnlockEntry = null;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
//Now wait also for "forgotToLockAsyncCheck" to finish
|
//Now wait also for "forgotToLockAsyncCheck" to finish
|
||||||
Promise.all([forgotToLockAsyncCheck])
|
// Promise.all([forgotToLockAsyncCheck])
|
||||||
.then(() => {
|
// .then(() => {
|
||||||
resolve(incidents);
|
// resolve(incidents);
|
||||||
})
|
// })
|
||||||
.catch(error => reject(error));
|
// .catch(error => reject(error));
|
||||||
|
})
|
||||||
|
.catch((error) => reject(error))
|
||||||
|
}
|
||||||
|
|
||||||
|
//Now wait for "forgotToLockAsyncCheck", and possible "getEntriesBetween" to finish
|
||||||
|
Promise.all([forgotToLockAsyncCheck, getEntriesAsyncCheck])
|
||||||
|
.then(() => {
|
||||||
|
resolve(incidents);
|
||||||
})
|
})
|
||||||
.catch((error) => reject(error))
|
.catch(error => reject(error));
|
||||||
})
|
})
|
||||||
.catch(error => reject(error));
|
.catch(error => reject(error));
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user