Sensorial’Org

Code Sprint: Day 2

I just finished day 2 of the reading week code sprint (coding 9-5 for 3 days), having been operating on 3 hours of sleep because I was putting together a presentation.

For the past two days, I’ve been implementing the TA to Student mapping. There’s one instance of OLM per course, and for each instance, there is a set of users and a set of TAs. When users submit assignments (either individually or as a group), there needs to be a way for the instructor to assign some TA to mark them. We are considering two main strategies for this: (1) each TA marks some subset of students/groups; (2) every TA marks some section of all assignments.

olm_mapping.jpg
At the moment, the interface is like this. I’ve accomplished:

  • Users can select any number of groups by clicking on them; groups can be deselected from the same gesture. (In the future, users should also be able to select a series of groups)
  • Users can select any TA by clicking on them; a TA can be deselected with the same gesture. However, only one TA can be selected at time. It behaves like a radio button.
  • Users can assign a set of groups to a set of TAs.
  • Learned how to use both the rails debugger (available with gem install ruby-debug, and Firebug’s console feedback =)

Struggles

When a user clicks on “Assign TA”, the event is handled by a JavaScript function. Every time a group/TA is selected/deselected, the data structure holding the set of groups/TA is updated. Once the “Assign TA” event has been received, an AJAX request is sent to the controller passing this information via parameters.

The set of groups is stored as an array using JavaScript. This in turn is converted to an JSON string using the Prototype library (i.e. myArray.toJSON()) before it is sent to the controller.

The controller receives this information as a string. So if you try iterating it using Ruby’s .each construct, the only element you’ll get is that string. This JSON must be decoded: ActiveSupport::JSON.decode(myJSONstr).

To be done

  • Display the number of groups each TA has assigned to them
  • Toggle groups by TA (including those who hasn’t been assigned a TA).

Leave a Comment