Showing available rooms using time slot filtering

Options
Hey everyone! 

I'm trying to display all available meeting rooms with a condition of only showing meeting rooms that are not booked for a user given time period 

Some context : 
Booking table contains startTime, endTime and meetingRoom Id

Meeting room table contains information relevant to the room like name, pictures etc 


What I've tried 
Using a join (meeting room & booking data tables) and put a condition where user start time is not equal to booking.startTime. As you can imagine, it's not working 

Any suggestions on what I can try doing? 

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    Hey  - this might be a good use case for Addons. Quick question - is user start time pulled from the user table or is it an input? 
  • yashwin
    yashwin Member
    Options
    Hey Michael 👋

    It's an input from the front end. Once the user is done selecting a date time filter, I'll be sending a GET API request with all necessary input values to Xano  

    My hope is that if I'm able to get this to work, I want to see how far I can push filtering by adding more conditions
    [Desktop_-_1.jpg]front end for your reference 
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    Thank you-  here's me talking about how you will want to think about doing this both from a DB perspective and API/task perspective

    
  • yashwin
    yashwin Member
    Options
     thank you for the walk through! 

    I had initially thought about doing this but I ran into some logic problems

    Like, if a user wants to book meeting rooms for 2 hours, I can in the booking table book out two slots. 
    but on the front end, they would input for example, 4pm - 6pm available meeting rooms, which in this example would return 2 results for the same meeting room. One result for 4pm-5pm and the next for 5-6. 

    Another minor concern I had was the amount of rows this would create in the db, even if it's a small space with 4 rooms (4 * 12 slots * 30 days) 

    Maybe I'm doing something wrong or maybe approaching the problem from the front end wrong? 
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    If a user wants to book multiple blocks of time. In this example, each block is an hour so 2 blocks = 2 hours, then you will want to do a For Each Loop through each block the user wants to book and nest your Edit Record function to edit each record returned. 

    Yes, you will be creating a lot of records for this table. You will want to determine how far out in the future you want to show availability (e.g. 1 week, 2 weeks, 1 month, etc.) You can also consider a background task to delete records if you don't need a history of them after however long.