[nycphp-talk] Events Management - is there a solid F/OS code base ?
csnyder
chsnyder at gmail.com
Wed Mar 29 17:23:17 EST 2006
On 3/29/06, Brian O'Connor <gatzby3jr at gmail.com> wrote:
> The way I always handled occurance was to have two fields in the database, a
> key (usually an integer), and a value, which I stored as a string.
>
> I then had a function which took an event and a day in, and checked the
> events occurance key / value to see if it applied for that day, and returned
> either true or false.
>
> I doubt this is the most efficient way, but it works for me.
Let's say I want to render all of the events on a particular date:
April 1, 2006, a Saturday. There is an event on January 18, 2003 (also
a Saturday) which is set to recur every two weeks... which translates
in this case to "odd Saturdays". Okay, I see how that would work.
For any given day you generate a list of all the possible matches
(April 1, 2006 is a Saturday, an odd Saturday, first Saturday, first
of the month, etc), and then SELECT against those matches to find the
events that apply.
And multi-day events would just work, as long as you enforce a maximum
duration, right? If events can last up to 5 days, you have to start
your lookups 5 days before the month in question in order to capture
recurring events that started before, but end during the month.
To be truly useful you need to have an override mechanism -- one time
events that mask out properties on a recurring event. We have a
monthly meeting the recurs on 4th Tuesdays, but each instance of that
event has a different "who" and "what". That seems like the easy part.
A truly excellent implementation would even allow you to push or pull
the start date, so that Cliff could reschedule the publication of his
newsletter.
You might also want an event log to track events that have actually
happened, so that when a recurring event is updated to reflect a new
reality, it doesn't rewrite history.
John, your taxonomy idea is interesting (fetch events tagged
"Wednesdays") and essentially the same as the "key/value" approach
Brian described. If you're using a system that has robust tagging
(like Ning) it might save some time.
--
Chris Snyder
http://chxo.com/
More information about the talk
mailing list