cal.com icon indicating copy to clipboard operation
cal.com copied to clipboard

[CAL-935] Already booked event is still included in availability

Open bhopmann opened this issue 2 years ago • 6 comments

Issue Summary

Current events are disregarding already booked spots. This means bookers generally don't know when a time is taken, because already accepted events still do appear in the appointment selection. Only at the end of scheduling an error message appears: "Could not book the meeting. [Name] is unavailable at this time".

Steps to Reproduce

  1. Set availability in backend
  2. Book a spot
  3. Check booking page again: already booked event is still included in availability

Instead, already booked and accepted event should be hidden on availability page.

Technical details

  • Browser version: Firefox 98.0.2.
  • Node.js version: v14.19.1
  • Cal.com: selfhosted, latest github version (f71c0dd)
  • No external calendars are connected
  • There has been a similiar bug report: https://github.com/calcom/cal.com/issues/1271
  • Log:
@calcom/web:start: RangeError: Invalid time value
@calcom/web:start:     at Date.toISOString (<anonymous>)
@calcom/web:start:     at /.../apps/web/.next/server/chunks/1880.js:2986:110
@calcom/web:start:     at Array.map (<anonymous>)
@calcom/web:start:     at /.../apps/web/.next/server/chunks/1880.js:2984:50
@calcom/web:start:     at processTicksAndRejections (internal/process/task_queues.js:95:5)
@calcom/web:start:     at async Promise.all (index 0)
@calcom/web:start:     at async handler (/.../apps/web/.next/server/pages/api/book/event.js:894:37)
@calcom/web:start:     at async Object.apiResolver (/.../node_modules/next/dist/server/api-utils/node.js:182:9)
@calcom/web:start:     at async NextNodeServer.runApi (/.../node_modules/next/dist/server/next-server.js:386:9)
@calcom/web:start:     at async Object.fn (/.../node_modules/next/dist/server/base-server.js:488:37)
@calcom/web:start:     at async Router.execute (/.../node_modules/next/dist/server/router.js:228:32)
@calcom/web:start:     at async NextNodeServer.run (/.../node_modules/next/dist/server/base-server.js:600:29)
@calcom/web:start:     at async NextNodeServer.handleRequest (/.../node_modules/next/dist/server/base-server.js:307:20)
@calcom/web:start: calendarBusyTimes==>>> [ { end: 2022-04-05T10:15:00.000Z, start: 2022-04-05T10:00:00.000Z } ]
@calcom/web:start: 07:29:24.844 timeZoneName DEBUG [api] book:user Booking [name] failed
@calcom/web:start: {
@calcom/web:start:   errorCode: 'BookingUserUnAvailable',
@calcom/web:start:   message: '[name] is unavailable at this time.'
@calcom/web:start: }

CAL-935

bhopmann avatar Apr 01 '22 07:04 bhopmann

Hi there! Thanks for reaching out

Do you have a calendar connected? Because if you don't, that's what is causing this issue. At this point in time, we do not yet check our own events for conflicts (intended to be added by the virtual calendar); this will come relatively soon but that is likely the cause of the confusion.

milospuac avatar Apr 01 '22 08:04 milospuac

Thank you for your hint: Connecting a calendar (nextcloud) does resolve this issue. But I notice some problems when rescheduling an event: A rescheduled event only occurs in the cal.com backend, but not in the availability section and not in the connected calendar.

@calcom/web:start: (node:19478) UnhandledPromiseRejectionWarning: FetchError: invalid json response body at [calendar-url] reason: Unexpected token < in JSON at position 0
@calcom/web:start:     at /.../node_modules/next/dist/compiled/node-fetch/index.js:1:49606
@calcom/web:start:     at processTicksAndRejections (internal/process/task_queues.js:95:5)
@calcom/web:start: (Use `node --trace-warnings ...` to show where the warning was created)
@calcom/web:start: (node:19478) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 38)
@calcom/web:start: (node:19478) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

bhopmann avatar Apr 01 '22 09:04 bhopmann

I see... Our engineers will have a look at this

milospuac avatar Apr 04 '22 08:04 milospuac

Hello @milospuac, Is this issue still available, I could help take a look at it

LuisChiej avatar May 09 '22 11:05 LuisChiej

This is still happening

1 hour booking link

image

Even though booking already exists

image

These two are in different availabilities, but does that mean that they are ending up in different calendars in the backend? If so, that should be made apparent to the user. IMO, they should all be entered into the same calendar regardless of chosen availability.

LoveIsGrief avatar Nov 02 '22 16:11 LoveIsGrief

I could not replicate this, still happening? @LoveIsGrief

roae avatar May 23 '23 00:05 roae

This is very, very fixed @roae - no longer an issue.

emrysal avatar May 26 '23 11:05 emrysal