diff --git a/back/api/booking/models/booking.js b/back/api/booking/models/booking.js index 947f63f0..c6e5bc6e 100644 --- a/back/api/booking/models/booking.js +++ b/back/api/booking/models/booking.js @@ -23,14 +23,16 @@ const updateDispo = (dispos = [], status) => { if (status === "available") { data.booking = null; } - dispos.map((dispo) => { - strapi.query("disponibility").update({ id: dispo.id }, data); - if (status === "available") { - strapi - .query("disponibility") - .create({ ...dispo, place: null, status: "canceled" }); - } - }); + dispos + .filter((dispo) => dispo.status !== "removed") + .map((dispo) => { + strapi.query("disponibility").update({ id: dispo.id }, data); + if (status === "available") { + strapi + .query("disponibility") + .create({ ...dispo, place: null, status: "canceled" }); + } + }); }; const getDispoEmail = (dispos = []) => { diff --git a/back/api/booking/services/booking.js b/back/api/booking/services/booking.js index 26ecfdcd..9c6f7ec1 100644 --- a/back/api/booking/services/booking.js +++ b/back/api/booking/services/booking.js @@ -9,6 +9,7 @@ const isPast = require("date-fns/isPast"); module.exports = { async checkIsPast(booking) { + if (!booking.disponibilities) return booking; if ( booking.status === "pending" && isPast(min(booking.disponibilities.map((dispo) => new Date(dispo.start)))) diff --git a/back/extensions/documentation/documentation/1.0.0/full_documentation.json b/back/extensions/documentation/documentation/1.0.0/full_documentation.json index 5d2f9df6..d98cc747 100644 --- a/back/extensions/documentation/documentation/1.0.0/full_documentation.json +++ b/back/extensions/documentation/documentation/1.0.0/full_documentation.json @@ -14,7 +14,7 @@ "name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0.html" }, - "x-generation-date": "05/27/2021 3:44:21 PM" + "x-generation-date": "05/27/2021 3:56:48 PM" }, "x-strapi-config": { "path": "/documentation", diff --git a/web/components/Account/Booking/BookingDrawer.tsx b/web/components/Account/Booking/BookingDrawer.tsx index 1ee58355..1baee4cf 100644 --- a/web/components/Account/Booking/BookingDrawer.tsx +++ b/web/components/Account/Booking/BookingDrawer.tsx @@ -239,6 +239,7 @@ const BookingDrawer = ({ bookingId, setSelected, type }: Props) => { /> {![ + 'expired', 'requestcanceled', 'requestcanceledbyplace', 'bookingcanceledbyplace',