ggeiger — 2013-03-22T10:24:15-04:00 — #1
I built an event calendar where people can post their own events. I'd like to offer an option to the user who wants to post an ongoing event. One example is a class that happens every Saturday at the same time. Another is a museum that's having an ongoing show every Monday - Friday until August 31st.
I already have start date, start time, end date, end time as fields in the db.
What I was thinking was a showing the user a dropdown that lets them select:
Every (pick days)
Every other (pick days)
Then show checkboxes for:
Then a date field for End Date.
My question is what is a good way to handle this in the database architecture. And what question to ask to get them to show up.
I don't think I should create hundreds of records for the person who chooses Every Day until the end of time.
I was hoping I could create a field for the record that showed date frequency, then ask the database the right query to get the events to show up with the others.
Perhaps looking at my calendar would make sense. Any ideas would be very much appreciated.
jurn — 2013-03-23T17:37:11-04:00 — #2
I don't think you can get the database to return you dates until end of time. You'd be better off putting that logic in your application.
ggeiger — 2013-03-24T13:23:11-04:00 — #3
With a cut off of, say 120 new records I think the option of storing each event as a record might work best. How else would I allow users to edit an individual event in their recurring group? Data storage is cheap, and it makes some sense to do it this way.
jurn — 2013-03-24T14:00:31-04:00 — #4
Yep maybe it is ok for your app.
What about the scenario where they want to change the recurring event?
For individual events you can consider 'exceptions', similar to how ics calendar files work. Again this will push more logic into your app.
ggeiger — 2013-03-24T21:21:29-04:00 — #5
I would have to offer a way for the user to edit the group, or edit a specific event, then provide a list. How to edit the group I'm not totally clear on. Perhaps I could let the first event that is entered in to the database be the parent, then insert the repeat events with a parent ID. The user would edit the parent, then I'd loop through the child events and update them as well. Perhaps skipping any child events that have a modified date, as they might have been treated as an 'exception' by the user
It would also be easier for a user to delete a child event from the group, the scenario being they are closed that day. They could simply create the recurring events, then delete the ones they don't want.
I don't see good examples,of this being done in available web apps (like Facebook events) and it is likely because its so hard to do it well.