MarkUs Blog

MarkUs Developers Blog About Their Project

Adding groups using a CSV file

without comments

I stepped into the world of Ruby on Rails through the Markus Project. One of the main tasks that I completed during the Ucosp term was revising the CSV group upload feature. In production, the function is used by administrators to create groups for an assignment by specifying the group name, repository name, and the group members for all groups in a CSV file format. The function already existed in MarkUs, but was in need for a few modifications such as checking membership and repository equivalences when reusing existing groups. Moreover, the previous implementation destroyed all existing groupings for an assignment at the start of the upload and created brand new groupings which prevented incremental group uploads. This was to be changed so that the existing groupings were not deleted.

The first week was spent tracing through the code trying to figure out how the logic behind the CSV group creation worked while also learning the Ruby on Rails framework. The progress was slow, and huge gaps still remained in my understanding. Since tracing through the code didn’t seem to help much, I decided to draw out the flow chart for the function. Seeing the code transformed into a set of shapes and arrows helped me understand what the current code was doing. However, I soon realized that I had no idea of what the expected behaviour should be or what the specific user requirements were for all the corner cases that came into my head. It was time to ask for help.

After the first meeting with Karen Reid, I had enough understanding of the requirements to create a code skeleton. I drew up another diagram with the logic flow for all the different scenarios that I could come up with. It was difficult to decide whether a user error should be fixed, ignored or blocked so the flow chart ended up with many branches that ended in “what if”s. During the second meeting however, most of those “what if” cases were resolved as user errors which made the CSV upload function much cleaner and easier to implement.

The final flow chart is given below. Some useful terms used in the diagram are:

  • A group is a relationship between a group_name and a repo_name which corresponds to a repository instance
  • A grouping is a relationship between a group, an assignment and student memberships


Written by Binuri Walpitagamage

December 11th, 2015 at 1:26 pm

Leave a Reply