• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 460
  • Last Modified:

How to store repeating events i db

I'm given the task to create a calendar on our club site - I will probably be using FullCalendar (http://arshaw.com/fullcalendar/) and for sure php/mysql as backend.

But I'm not sure how to save repeating events in the db, so I'm looking for input and articles on that issue.

Eg. A user creates an event "Clean refrigiator" that should repeat every weekday at 7:30

Instead of creating 365 events * N years - how should I store these events in the mysql db so it's quick to retrieve them again ?

Any input is appreciated.
0
internetservice_dk
Asked:
internetservice_dk
  • 3
  • 2
1 Solution
 
Julian HansenCommented:
In addition to setting the fields for when to run you set an expires date in the future for when the event is valid until

For repeating forever dates pick something far enough in the future that when it becomes a problem they won't ask you to fix it.

Then when you retrieve the events simply look for events that have not expired.

You can run a regular cleanup job to cleanup events that have expired (simple solution) or build in a cleanup into your query.

I can give you more detail on the exact mechanics of how to do this - post back if you would like more detail
0
 
internetservice_dkAuthor Commented:
julianH - thanks for your reply.

Perhaps I was not being specific enough - the example where an event is repeated every day is perhaps too simple.

So the user adds an event thet should repeat every monday @ 08:00, every wednesday @ 10:00 and every second saturday @ 13:00

I need to be able to track if each task has been completed (could be clean refrigiator or similar task at a workplace)

Best regard,
M
0
 
Julian HansenCommented:
I did understand - was answering the question on how to get around having to save N events in the db - the solution is to use an expiry date.

If you need the full spec for how to save scheduled events in the db then these might be of assistence

http://martinfowler.com/apsupp/recurring.pdf
http://stackoverflow.com/questions/5183630/calendar-recurring-repeating-events-best-storage-method
0
 
internetservice_dkAuthor Commented:
Thanks for the links - they got me on the way :)
0
 
Julian HansenCommented:
You are welcome - thanks for the points.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now