In this episode, we focus on cleaning up our available slots after assigning employees based on their availability. Now that employees are slotted in, it’s time to tidy things up by removing any empty slots—basically, getting rid of times where no employees are available.
We walk through creating a new method called removeEmptySlots
, which filters out any slots without employees. We take a look at how filtering on the collection not only removes empty slots, but also completely removes dates that have no available slots, which keeps our schedule view neat and relevant. For the rare times when a date has no slots but should remain on the calendar (so users know the day exists), we talk about graying out that day as unavailable.
We put this into practice by adding and removing some schedule exclusions and checking how the filtering works in real-time. The end result: our user will only ever see dates and times that actually have someone available—no wasted clicks or confusion.
Coming up next, we’ll tackle how to filter out slots that already have appointments booked, taking our availability system to the next level!