Description:
fixed grading wrong submission when 2 submissions created at the same time git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@373 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r68:fd3aca136ef8 - - 1 file changed: 1 inserted, 4 deleted

@@ -19,28 +19,25
19 submission = Submission.find(task.submission_id)
19 submission = Submission.find(task.submission_id)
20 @engine.grade(submission)
20 @engine.grade(submission)
21 task.status_complete!
21 task.status_complete!
22 @grader_process.report_inactive(task) if @grader_process!=nil
22 @grader_process.report_inactive(task) if @grader_process!=nil
23 end
23 end
24 return task
24 return task
25 end
25 end
26
26
27 def grade_problem(problem)
27 def grade_problem(problem)
28 users = User.find(:all)
28 users = User.find(:all)
29 users.each do |u|
29 users.each do |u|
30 puts "user: #{u.login}"
30 puts "user: #{u.login}"
31 - last_sub = Submission.find(:first,
31 + last_sub = Submission.find_last_by_user_and_problem(u.id,problem.id)
32 - :conditions => "user_id = #{u.id} and " +
33 - "problem_id = #{problem.id}",
34 - :order => 'submitted_at DESC')
35 if last_sub!=nil
32 if last_sub!=nil
36 @engine.grade(last_sub)
33 @engine.grade(last_sub)
37 end
34 end
38 end
35 end
39 end
36 end
40
37
41 def grade_submission(submission)
38 def grade_submission(submission)
42 puts "Submission: #{submission.id} by #{submission.user.full_name}"
39 puts "Submission: #{submission.id} by #{submission.user.full_name}"
43 @engine.grade(submission)
40 @engine.grade(submission)
44 end
41 end
45
42
46 def grade_oldest_test_request
43 def grade_oldest_test_request
You need to be logged in to leave comments. Login now