Last active
December 23, 2015 13:49
-
-
Save cmatheson/6644217 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N_ASSIGNMENTS=100 | |
N_USERS=500 | |
begin | |
account = Account.default | |
account.transaction do | |
course = account.courses.create! name: "Big Gradebook" | |
e = course.enroll_teacher(User.find(1)) | |
N_ASSIGNMENTS.times do |i| | |
printf "\rmaking assignment... %3d/%d", i+1, N_ASSIGNMENTS | |
course.assignments.create! name: "Assignment #{i+1}", | |
submission_types: "online_text_entry", | |
points_possible: rand(100) | |
end | |
puts | |
500.times.each do |i| | |
printf "\rmaking student... %3d/%d", i+1, N_USERS | |
u = User.create! :name => "student #{i + 1}" | |
e = course.enroll_student(u) | |
e.update_attribute(:workflow_state, 'active') | |
end | |
puts | |
# grade the students | |
course.assignments.each_with_index do |a, i| | |
course.students.each_with_index do |s, j| | |
printf "\rgrading student %3d/%d for assignment %3d/%d", | |
j+1, N_USERS, i+1, N_ASSIGNMENTS | |
a.grade_student(s, grade: rand(a.points_possible)) unless rand > 0.9 | |
end | |
end | |
end | |
ensure | |
puts | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment