From cd77159ea2a77584b585bbee454ed446f4729cdb Mon Sep 17 00:00:00 2001 From: Bilal Catic Date: Wed, 11 Sep 2019 12:25:25 +0200 Subject: [PATCH 1/3] fix charging reservation changes --- services/integration/bookingChangeCharges.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/integration/bookingChangeCharges.js b/services/integration/bookingChangeCharges.js index 086d0b0..9412561 100644 --- a/services/integration/bookingChangeCharges.js +++ b/services/integration/bookingChangeCharges.js @@ -76,7 +76,14 @@ const getIncidentsFromChanges = (changes) => { const reservationHourlyRate = oldReservation.hourlyRate ? oldReservation.hourlyRate : newReservation.hourlyRate; const canceled = newReservation.canceled; - if (oldStart && oldEnd && newStart && newEnd && reservationHourlyRate){ + // console.log('oldStart : ', oldStart ? oldStart.format() : 'null'); + // console.log('oldEnd : ', oldEnd ? oldEnd.format() : 'null '); + // console.log('newStart : ', newStart ? newStart.format() : 'null'); + // console.log('newEnd : ', newEnd ? newEnd.format() : 'null'); + // console.log('hourly Rate : old : ', oldReservation ? oldReservation.hourlyRate : ' - ', newReservation ? newReservation.hourlyRate : ' - '); + // console.log('Canceled : ', newReservation.canceled); + + if (oldStart && oldEnd && newStart && newEnd){ const oldReservationLength = oldEnd.diff(oldStart, 'hours', true); const newReservationLength = newEnd.diff(newStart, 'hours', true); -- 2.47.3 From dc0a335eb9ca16da2e90a99c5b378098076aa4fa Mon Sep 17 00:00:00 2001 From: Bilal Catic Date: Wed, 11 Sep 2019 12:25:46 +0200 Subject: [PATCH 2/3] fix hourly rate value --- services/officeRnD/bookings.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/officeRnD/bookings.js b/services/officeRnD/bookings.js index 0ae97e5..c4ae11a 100644 --- a/services/officeRnD/bookings.js +++ b/services/officeRnD/bookings.js @@ -184,7 +184,9 @@ const bulkWriteReservationsWithChangesTracking = (reservations) => { } }); - instance.setDataValue('hourlyRate', instance.previous('hourlyRate')); + if (instance.hourlyRate === 0 && parseFloat(instance.previous('hourlyRate')) > 0){ + instance.setDataValue('hourlyRate', instance.previous('hourlyRate')); + } if (realChange){ changes.push({ -- 2.47.3 From 0a4da1b18fc10fb50a77ff1da65750454913ccd6 Mon Sep 17 00:00:00 2001 From: Bilal Catic Date: Wed, 11 Sep 2019 12:26:08 +0200 Subject: [PATCH 3/3] fix dates in fees description --- services/integration/invoiceIntegration.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/integration/invoiceIntegration.js b/services/integration/invoiceIntegration.js index 1af6e79..26d78b3 100644 --- a/services/integration/invoiceIntegration.js +++ b/services/integration/invoiceIntegration.js @@ -128,7 +128,7 @@ const createFeeFromIncident = (incident) => { roomExplanation = newResourceName; // dateExplanation = `${oldBookingStartMoment.clone().format('ddd, MMM DD')} -> ${newBookingStartMoment.clone().format('ddd, MMM DD')}`; - dateExplanation = `${incidentTimestampMoment.clone().format('MMM DD')}`; + dateExplanation = `${newBookingStartMoment.clone().format('MMM DD')}`; bookingTimeExplanation = `[${newBookingStartMoment.clone().format('HH:mm')} to ${newBookingEndMoment.clone().format('HH:mm')}]`; incidentTimeExplanation = `moved on : ${incidentTimestampMoment.clone().format('MMM DD, HH:mm')}`; incidentExplanation += `, ${incidentTimeExplanation}`; @@ -147,7 +147,7 @@ const createFeeFromIncident = (incident) => { roomExplanation = newResourceName; // dateExplanation = `${oldBookingStartMoment.clone().format('ddd, MMM DD')}`; - dateExplanation = `${incidentTimestampMoment.clone().format('MMM DD')}`; + dateExplanation = `${newBookingStartMoment.clone().format('MMM DD')}`; bookingTimeExplanation = `[${newBookingStartMoment.clone().format('HH:mm')} to ${newBookingEndMoment.clone().format('HH:mm')}]`; incidentTimeExplanation = `shortened on : ${incidentTimestampMoment.clone().format('MMM DD, HH:mm')}`; incidentExplanation += `, ${incidentTimeExplanation}`; @@ -160,7 +160,7 @@ const createFeeFromIncident = (incident) => { case incidentType.BOOKING_CANCELED_LATE: roomExplanation = oldResourceName; // dateExplanation = `${oldBookingStartMoment.clone().format('ddd, MMM DD')}`; - dateExplanation = `${incidentTimestampMoment.clone().format('MMM DD')}`; + dateExplanation = `${oldBookingStartMoment.clone().format('MMM DD')}`; bookingTimeExplanation = `[${oldBookingStartMoment.clone().format('HH:mm')} to ${oldBookingEndMoment.clone().format('HH:mm')}]`; incidentTimeExplanation = `canceled on : ${incidentTimestampMoment.clone().format('MMM DD, HH:mm')}`; incidentExplanation += `, ${incidentTimeExplanation}`; -- 2.47.3