-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhardest2.py
More file actions
32 lines (26 loc) · 835 Bytes
/
hardest2.py
File metadata and controls
32 lines (26 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Find the activity with the highest average number of
# submissions per student (omitting instructors)
import sys, progsnap
filename = sys.argv[1]
dataset = progsnap.Dataset(filename)
activity = None
highest_avg = 0
for a in dataset.activities():
total = 0
n = 0
for wh in dataset.work_histories_for_activity(a):
student = dataset.student_for_id(wh.student_id())
if not student.instructor():
subs = [e for e in wh.events()
if type(e) is progsnap.Submission]
total += len(subs)
n += 1
avg = total / n
if avg > highest_avg:
activity = a
highest_avg = avg
print("Activity {}, {} submissions/student"
.format(activity.number(), highest_avg))
# Note that the formatting of this file is somewhat
# awkward because it was used in a poster where space
# was at a premium.