ucrcsedept / galah

An automated grading system geared towards processing computer programming assignments.
Apache License 2.0
42 stars 8 forks source link

assignment_progress request for sorted distribution #321

Closed atkoehler closed 11 years ago

atkoehler commented 11 years ago

Currently the distribution is a map and is just printed in whatever manner it is stored in within the datastructure. It makes much more sense to print it after sorting it so that grades are listed in an easily readable manner.

https://github.com/galah-group/galah/blob/v0.2dev/galah/web/api/commands.py#L746

currently:

for score in distribution:
    progress += "%d: %d\n" % (score, distribution[score])

suggested:

sorted_distribution = sorted(distribution.iteritems(), key=operator.itemgetter(0))
for (score, count) in sorted_distribution:
    progress += "%d: %d\n" % (score, count)
paranoiacblack commented 11 years ago

I'm a bit confused by this. Are you seeing out of order scores somehow? The results are ordered by score, so when they are added to the distribution map, they should only be added in ascending order. It's really just a sorted array I'm iterating, but I decided to make it a map since score ranges will vary wildly. I might be wrong, but the code you suggested is already being executed slightly above it:

https://github.com/galah-group/galah/blob/v0.2dev/galah/web/api/commands.py#L728-L734: This will get all test results by score in ascending order.

https://github.com/galah-group/galah/blob/v0.2dev/galah/web/api/commands.py#L738-L743: Since they are in ascending order, the keys should start from 0 and go to 100 when stored in the distribution map. Unless I'm misunderstanding something about the order of python dicts.

atkoehler commented 11 years ago
(Galah API) bash-3.2$ assignment_progress "CS 10v/Hangman" 1
--Acting as user akoeh001@cs.ucr.edu--
33 out of 107 students have submitted
-- Grade Distribution (Points: # of students) --
0: 9
65: 2
100: 9
50: 6
20: 1
25: 6