[geeklog-devel] Calendar Plugin - Recurring Events

Vlad Voicu vladvoic at gmail.com
Thu Apr 1 12:31:12 EDT 2010

On Thu, Apr 1, 2010 at 4:38 PM, Samuel Leathers <sam at theleathers.net> wrote:

> 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

I think this is the right way also.

> 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.

You can check my application, I suggested a similar solution. Only
generating for
2 years ahead. I also proposed a minimal database structure in my
application and
a solution for exceptions.

I don't think a cronjob is the best approach, but generating when a
user reaches the
end of the half(as I suggested) or the end of pre-generated period
like you suggested.
I found interesting information about this matter here: [1]

> 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).

I think that just a field of Remind_me and one of remind_me_value will suffice.
Once a day the function will look in the database for events of tomorrow,
if there are any events marked as remind_me and the remind_me_value is
1 it will send
the emails with the .ics attached. If the user selects remind me one
week before, the
script will look if 7 days ahead of this day is any event that has the
remind_me field true and the
remind_me_value = 7. That is pretty fast I think as you only check 1
day for events maybe 5
times for 5 different type of remind_me_value values. x probably equal
to 3 (remind me a day
before 2 days before, etc) This can be done with a cronjob on a
certain hour of a day.

> Just some thoughts. Wondering what everyone thinks, especially Vlad,
> since he's writing a proposal for this plugin.

[1] http://www.justatheory.com/computers/databases/postgresql/recurring_events.html

I expect an opinion also,

More information about the geeklog-devel mailing list