MongoDB is an opensource document-oriented database in the vein of CouchDB. It’s been a while since I wanted to try this kind of database on a Rails project. After reading this nice tutorial today I decided to take some time to create a sample Rails 3 app and put it on github.
I chose to use MongoMapper, a ruby object mapper for Mongo. MongoMapper uses ActiveModel and let you interact with a MongoDB database in a very ActiveRecord way.
Hope this sample app will help you getting started with MongoDB!
Month: November 2010
Generate round-robin sport schedules with RRSchedule
One of our projects, called Mon Curling, is a web application that helps recreational curling leagues with their schedules, results and standings. One thing that the app was NOT doing was to generate the schedule automatically. Instead, the league manager had to generate his schedule beforehand and enter all the matches manually in our interface.
This will now change with the new gem I am working on called RRSchedule (code is also on github).
I realized that most sport leagues were using a round-robin format for their seasons and this is how I had the idea to make a gem out of it.
The gem takes into consideration the number of available “playing surfaces” and multiple game times. Say for example that you want to generate a round-robin schedule for your 19-teams volleyball league where games are played every wednesday. If there are 3 volleyball fields available and that games are played at 7:00 PM and 9:00 PM. This means that 6 games can be played every gameday (3 volleyball fields * 2 game times).
Example:
Gameday #1
========
A vs B on Volleyball field “A” will play at 7:00 PM
C vs D on Volleyball field “B” will play at 7:00 PM
E vs F on Volleyball field “C” will play at 7:00 PM
G vs H on Volleyball field “A” will play at 9:00 PM
I vs J on Volleyball field “B” will play at 9:00 PM
K vs L on Volleyball field “C” will play at 9:00 PM
Since the round-robin round can not be completed on a single day, the remaining games in the round will be put on the next gameday and a new round will start right after.
I hope this gem will be useful to some people!