[geeklog-devel] Calendar Plugin - Recurring Events
sam at theleathers.net
Thu Apr 1 09:38:02 EDT 2010
-----BEGIN PGP SIGNED MESSAGE-----
I wanted to maybe start bouncing ideas around about how to implement
recurring events. I started by taking an ical file exported from my
google calendar to get an idea of how it stores it, thinking that might
be a good way to structure the database to make generation of an ical
file simple. Lets start a dialog about how is best to represent these
events. This is a sample event:
UID:msfeaphkg5p9eedmff4ide7bjo at google.com
The interesting parts are RRULE, DTSTART and DTEND.
DTSTART and DTEND are the start/end times for the first event. RRULE has
a frequency rule, an optional until rule, and in this case a by day
rule. However; looking at the spec:
it can be minutely, hourly, daily, weekly, monthly and yearly. And each
has it's own set of options.
So how do we encode this in the database? Do we have a column for
frequency, until, period, days, etc...
But what about this scenario:
The first Saturday that follows the first Sunday of the month,
How would you arrange that one in the database?
I think having a bunch of columns for recurring events could get real
ugly. My other thought was what if we mirror the ical structure in the
database like so:
columns: dtstart, dtend, rrule
And then write an ical class with a parser for displaying calendar
events. This could be slow (I don't know), but what if we augment this
ical backend in the database with a cache? Ical already supports a UID
field, so what if we cache calendar recurring events (dtstart, dtend no
rrule) in a cache table that expands recurring events for that month and
year (linked to uid of event it was built from). Then when someone views
a future month, it adds that month to the cache, or a crontab could be
set for off-peak hours to rebuild the cache for the upcoming year. The
cache could also contain "ghost" events for reminders for events. So
when someone has a remind me the day before, rather than parsing for the
event, checking if it's the day before, it queries the cache instead,
sees there is an event reminder linked to event uid of future event,
sends that reminder to all users (with an ical file including the event,
so they can import it directly into their calendar from their e-mail).
Just some thoughts. Wondering what everyone thinks, especially Vlad,
since he's writing a proposal for this plugin.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.13 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
More information about the geeklog-devel