MarkUs Blog

MarkUs Developers Blog About Their Project

Archive for the ‘parsing’ tag

Phase 1: Complete

without comments

This week, I’ve finally managed to wrap up the student management module in rails. I had some leftover work done from implementing the authentication and session timeouts, as well as writing several tests. Since there were several complaints in OLM before from TAs being timed out, we’ve decided to set different timeout lengths for students and faculty, giving longer timeouts for TAs to finish their work (although it wouldn’t hurt to save once in a while too).

Next, I moved on to implementing the page for managing the course classlist. This involved doing some parsing work for the uploaded CSV file. This took me a while since I was under the assumption that the given classlist would be separated by spaces. I’ve started looking for CSV parsers where you can change the default delimiter (you’d think this would exist). Since the search was in vain, I just implemented my own parser only to find out that there was no way to read the uploaded file line-by-line unless I write it first to a tempfile. By this time, Karen already sent me a sample classlist only to find out that it was indeed a normal CSV file (whew!). So I just used the rails CSV parser and everything works as planned.

The problem I have now is how to test uploading the file automatically. Fortunately, rails has something called a fixture_file_upload where you can just specify a sample upload file and call a post method on your action. I haven’t successfully tried to use this though, since I’m still getting some errors when running it. I’m running out of ideas why my tests are failing. I also ran into some problems dealing with error handling when trying to enter invalid inputs on creating and editing students. Turns out that the symbol declared in the form expects a global variable with the same name in order to hook them up together (who knew?). Things that are automatically done like this without telling you is where sometimes rails becomes a pain. Sometimes, declaring an innocent variable might be something that would override the default rails way of doing things. But all that hard work seemed to pay off once you get everything working (except for the upload tests).

Now, I was suppose to get the student file submission done by the end of the week, but I’m sort of glad that I didn’t. My initial design draft focused only on the uploading the file draft without even considering the next step: student groups. As it turns out, I might need to implement them at the same time to have a cleaner design with less hassle. The plan is to get a database schema that I can present to Karen and Jennifer by next week, together with some user stories on how partnerships will be done.

For now, I think I’ll continue reading up on my new Rails book, as well as watch Randy Pausch’s last lecture, which Luke hails as “simply amazing and inspiring”.

Written by Geofrey

August 1st, 2008 at 10:20 pm

Posted in OLM on Rails

Tagged with , ,