Hi folks, all doing OK?
I’m building an application that I’m wanting to use to run recurring events on, but I’m genuinely torn between using a model per event or something like RRule. I have certain neuroses that prevent me from making decisions like this without seeking guidance - potentially affirmation from someone on the outside that I’m not overlooking anything super obvious.
- An event can be weekly. Every Monday at 9am for example, but every event has a start and end date on the same day. One instance of an event can’t knock into another, it doesn’t happen and won’t
- I would like to implement a host of capabilities into each event, such as a case-by-case view policy (I don’t need help writing this, it’s ok!) Each event can have Builder content, participants, the whole thing. Also don't need help with this!
- The model per event thing sounds like it’ll be a weird idea because it might clog the database, but imagine it like a seasonal thing. This event runs every Monday at 9am until the end of winter. It’s a defined, limited number
Question marks against an RRule-adjacent approach
- It feels a bit unnatural to me to not have instances of models. This is event id 4, it's the specific one on Monday the 6th. Here's the participants for event id 4, here's the location. Here's how to get there
- I need to be able to manage RSVPs -and- attendances per event and I don’t quite know how to cleanly achieve this. It’s not immediately clear to me how I could effectively determine which event I'm marking myself as available for. If you were mapping this out today, would you just set something arbitrary and move on? Say, 'you can only mark your RSVP two days in advance, and the facilitator mark your attendance within the day after'?
I apologise wholeheartedly for the word-soup, but ask for kindness. I over-complicate and babble when I’m stuck, in the hopes I’ll be able to talk myself into a solution (I didn’t).
I have faced this exact dilemma on several occasions. There is no single correct answer. "It depends".
My preference is to create the recurring events as records in the calendar table. It's a bit of a pain to housekeep, though. Sometimes even impossible. Like, if the rrule is changed, you then have to sync up the calendar table, but the rrule may have been changed such that it is no longer clear which existing records match the new rule, which ones no longer exist, etc. Cop out there is simply to not allow the rrule to be changed. Which is where the "it depends" comes in ... do you need to support changing the rule?
Other than that, you just have to put some kind of rolling range window on the rrule, to set an end date. Like, creating a years worth of weekly events when the rrule is created, then a scheduled task that handles rolling the window forward, creating the new future events as required.