RJS Templates and ClockingIT

May 30, 2006

I'm getting more and more into Ruby on Rails' RJS Templates, and I'm really enjoying it so far. It's so easy to make sweeping changes to the page after an ajax call, all genereated from Ruby code. This functionality allowed me to update the completion percent and time estimates on all affected TaskLists when you edit a Task, using just a small loop and some well placed tags in the appropriate places.

There's also a periodically_call_remote which updates the header showing how long you've been working on a task as time passes. Unfortunately, there isn't an easy way to disable the periodical remote call, but I'll probably turn it into a more general pinger which will update tasks that have changed on the server so your page doesn't get out of sync with what's really there.

The calendar also got a massive speedup. I'd more or less just followed the example that came with the CalendarHelper, but that ends up looping through all your events once for each day — which takes ages when you have more than a couple of events. I ended up building a hash of due dates and the tasks that are due on that date, then just doing a lookup on each date instead. Rendering time for my ClockingIT project (with lots of milestones, due dates, tasks and messages) takes about 1 second now instead of 12 seconds which was the old average.

I'm sure I can speed things up further before we officially launch, but it's not too big of a problem to bother with now. I need to get the rest of the polish and required functionality in place so we can bring in some more testers.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: