Reputation: 24943
I'm currently working on an application that allows people to schedule "Shows" for an online radio station.
I want the ability for the user to setup a repeated event, say for example:-
"Manic Monday" show - Every Monday From 9-11 "Mid Month Madness" - Every Second Thursday of the Month "This months new music" - 1st of every month.
What, in your opinion, is the best way to model this (based around an MVC/MTV structure).
Note: I'm actually coding this in Django. But I'm more interested in the theory behind it, rather than specific implementation details.
Upvotes: 6
Views: 2361
Reputation: 5249
From reading other posts, Martin Fowler describes recurring events the best. http://martinfowler.com/apsupp/recurring.pdf
Someone implemented these classes for Java. http://www.google.com/codesearch#vHK4YG0XgAs/src/java/org/chronicj/DateRange.java
Upvotes: 1
Reputation: 1500805
Ah, repeated events - one of the banes of my life, along with time zones. Calendaring is hard.
You might want to model this in terms of RFC2445. However, that may well give you far more flexibility - and complexity than you really want.
A few things to consider:
I realise this is a list of things to think about more than a definitive answer, but I think it's important to define the parameters of your problem before you try to work out a solution.
Upvotes: 9
Reputation: 24943
I've had a thought that repeated events should be generated when the original event is saved, with a new model. This means I'm not doing random processing every time the calendar is loaded (and means I can also, for example, cancel one "Show" in a series) but also means that I have to limit this to a certain time frame, so if someone went say, a year into the future, they wouldn't see these repeated shows. But at some point, they'd have to (potentially) be re-generated.
Upvotes: 0