The exercises were three (3), and in each exercise they should have delivered the source code ziped and a jar with the compiled code.
I had the students registry numbers / names / teams (they were organised in team of 1-3 persons) and a list of delivered assignments, and i had to do the following:
- Produce a list with all students teams and see which teams had delivered the assignments correctly
- Examine one-by-one the Java source code and calculate the grade
The filename already contained the team number, deliverable number, and the registry number (of the student that submitted it), for example
2007A_2_8060035_1_source-2.zip
. I parsed the filename with a simple regex 2007A_([0-9]+)_([0-9]+)_(1|2|3)_.*\\.(zip|jar|rar)
.
The rest of it is really simple, create class instances containing the information regarding the students and the exercises and finally export the data to the template list.
Then something unexpected (at least for me ... the n00b) happened. The data produced by the first part of the program, could not be accessed correctly by the second (see the source code comments). I added a few print out line in the middle of the process and all where in place. What had happened?
The answer was really simple. Me, the Java man ... was really get used on strict type systems, and now forget that python resolves the types dynamically, and the key of the
teams
dictionary was really a string, not an integer that i used back then in the second part. Doh! It took me 30 mins to solve the mystery, and i finally realized the difference between the 1 and "1".