do not add reservations to the db for tentative and free bookings

This commit is contained in:
Bilal Catic
2020-01-15 19:29:57 +01:00
parent aa771bc7bd
commit 06601f272c

View File

@@ -116,6 +116,8 @@ const fetchAllBookings = () => {
const fees = fullBookingEntry && fullBookingEntry.fees ? fullBookingEntry.fees : [];
const firstFee = fees.length > 0 && fees[0].fee ? fees[0].fee : undefined;
const hourlyRate = firstFee && firstFee.price ? firstFee.price : 0;
const free = fullBookingEntry.free ? fullBookingEntry.free : false;
const tentative = fullBookingEntry.tentative ? fullBookingEntry.tentative : false;
const startMoment = fullBookingEntry && fullBookingEntry.start && fullBookingEntry.start.dateTime ?
moment.utc(fullBookingEntry.start.dateTime) : null;
@@ -126,7 +128,7 @@ const fetchAllBookings = () => {
// console.log('End : ', endMoment.clone().tz(fullBookingEntry.timezone).format('DD.MM. HH:mm'), '[', endMoment.toISOString(), ']');
// console.log('Fees : ');
if (startMoment && endMoment){
if (startMoment && endMoment && !free && !tentative){
cleanedBookingReservations.push({
reservationId: fullBookingEntry['_id'],
memberId: fullBookingEntry.member,