Josh Peck - Nerdlog » Page 'SharedLunch Update'

SharedLunch Update

I haven’t posted in a while, but it’s for a good cause. I just finished up the controller of SharedLunch. There’s still a fair amount of work to do before the UI will be completed, but it’s getting there.

This is the first project I’ve gotten to start using the full Rails TDD with ZenTest. No more running

rake test

for me!

ZenTest is like magic. I quite literally didn’t even look at a browser until the model and controllers were 90% complete. No distractions, just code to the test (and hope the tests are right). I have had to bounce back and forth a little after realizing that there were a few things that I didn’t account for when I devised the original tests, but it has allowed me to focus on one part of the program with fierce disregard for the UI.

Now that the program is mostly written, here’s roughly how it will work:

  1. One user invites their friends to join in on a meal that they will order sometime in the future
  2. Other users add their orders to the meal until the cutoff time
  3. The meal creator calls in the order and everyone eats
  4. The meal creator enters the actual costs into the system from the receipt

Simple enough, but keeps everyone ordering BEFORE the cutoff time and even helps keep track of the money so users can log in and see how much they owe.

The only tricky part I’ve encountered so far is managing each user’s time zone. Since the program enforced a cutoff time, it would be disastrous if users had to make date/time calculations back to CDT, CST, or even worse UTC. Apparently time zones are an area of Rails that isn’t quite flushed out yet. The packaged TimeZone class does not even support daylight savings time. Luckily, Peter Marklund describes a method for using the TZInfo library to perform the calculations without “too” much effort.

From Peter’s site: Rails Recipe: A Timezone Aware Datetime Picker

Look for the new site at the end of this month or at the beginning of the year!

© 2008 Josh Peck - Nerdlog is powered by WordPress