Hi guys,
I have created an Open Hours datatype for Venues, 1 for each day of the week with additional details of the venue. There is no easy way to extract and compare time in Bubble so i have to convert the hours to minutes to make comparisons:
In repeating groups I show the data like this, and to get the open times the conditional syntax needs to be as follows:
To only view “Open” venues, I have to merge 2 filtered searches and 1 regular search:
with additional filters that look like this. The reason I need to filter again is because I have to extract the day from the date to determine if the Open hour is for the current day.
Now this all works but once I start getting more than 15 venues in the Listshifter list it becomes very slow to apply filters to all these Open Hours.
How I can improve the efficiency of this, is there a better way to find open hours of venues and compare them to the current time to see if they’re open?
Seems like you shouldn’t be storing any dates since these are just arbitrary hours/minutes…
Instead you could store a numeric range field so if you want something open 9AM-5PM, you would store 9 as the minimum, and 17 as the max.
Then when you search for currently open Venues you can do Do a search for Open Hours with the constraint [your new numeric field] containts (point) Current date/time:extract hour then do :each item's Venue after the search
Then some of your other constraints would be Day field = Current date/time:extract day, and another numeric range for minutes.
Then you can delete your date fields, Open today yes/no, and probably a few others
EDIT: might be an issue with the 24hour time extracting hours because if its 5PM it might extract 5 instead of 17 but we can work on that
I don’t think so, if you had one for Day 0 from 2-3, then another Day 0 from 4-10 that should be fine.
Even if you accidently did 2-6, and another one 5-10 your repeating group can’t show duplicate Venues so it would just show up once. Although I do suggest if a user sets the open Venue hours you have it check if there’s a conflict before making the Open Hours thing. Just in case some weird stuff happens, I’m not sure if you did the search but then :count if it would actually count it twice or not.
Probably a yes/no on the Venue itself. Then after the :each item's Venue I described earlier do merged with Do a search for Venues and do the constraint [your 24/7 field] = yes
I’m just trying to dodge the advanced filters because the performance is trash once you get too many Venues (as you’ve seen), this way it’s kind of just all search constraints which should be instant. The only thing to consider now is how you would want to sort all of this… after all the searches you could do :sorted and do alphabetical or something…
Or some apps just do Random sorting to mix things up
I actually recommend doing some kind of sorting because of the merged with operator it’s going to show all the open venues because of their times, then after all of those it would then show the 24/7 ones grouped together
Or if someone buys a ticket to the venue have it add 1 to a number field for the Venue, so you can get a rank of most popular ones and sort by that number.
In the previous version i was able to show open hours quite easily, but now if i have multiple hour sets it won’t work, eg:
It’s usually 9 PM - 5AM, now its 9PM to 12 Am, 12Am to 5 AM, looks a bit silly lol
I’ve done some testing and the 24 hours can’t really work without the minutes, because if someone closes at 330AM, the 24 hour setup will show closed after 3 as its within the hour. A minute based numeric range doesn’t help as its hard to get the user to be within that specific minute range.
I’d like to still user the numeric range but its going to have to be minutes which means filters will be needed when searching to combine the current times hours+minutes to compare. There may be a reduced amount of filters though.