add debugging logs

This commit is contained in:
Bilal Catic
2019-12-05 09:27:39 +01:00
parent 166e2a0a9f
commit f9694570a5

View File

@@ -533,11 +533,42 @@ const getIncidentData = (reservation) => {
getEntriesBetween(fromTimestamp, toTimestamp, resourceId) getEntriesBetween(fromTimestamp, toTimestamp, resourceId)
.then((entriesBetween) => { .then((entriesBetween) => {
// const reservationMoment = moment.tz(currentReservation.start, currentReservation.timezone);
// if (currentReservation.memberId === '5ce785af422bdd00967fb781' && reservationMoment.isAfter('2019-11-23 00:00:16+00')) {
// console.log('\r\n\r\n==== ANALYSE RESERVATION [GET INCIDENT DATA] ==== ');
// console.log('\tStart : ', reservationMoment.format('DD.MM, HH:mm'));
// console.log('\tEnd : ', moment.tz(currentReservation.end, currentReservation.timezone).format('DD.MM, HH:mm'));
// console.log('\t----------------------------------');
// console.log('\tFirst previous reservation : is back to back [', previousReservationIsBackToBack ? 'T' : 'F', ']');
// if (previousReservation) {
// console.log('\t\tStart : ', moment.tz(previousReservation.start, previousReservation.timezone).format('DD.MM, HH:mm'));
// console.log('\t\tEnd : ', moment.tz(previousReservation.end, previousReservation.timezone).format('DD.MM, HH:mm'));
// } else {
// console.log('\t\tNO PREVIOUS RESERVATION');
// }
//
// console.log('\tFirst next reservation : is back to back [', nextReservationIsBackToBack ? 'T' : 'F', ']');
// if (nextReservation) {
// 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'));
// } else {
// console.log('\t\tNO NEXT RESERVATION');
// }
//
// 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.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: