Description:
[grader] fixed bug in runner for prob git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@137 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

r36:79248d481294 - - 1 file changed: 1 inserted, 1 deleted

@@ -1,54 +1,54
1 1 #
2 2 # A runner drives the engine into various tasks.
3 3 #
4 4
5 5 module Grader
6 6
7 7 class Runner
8 8
9 9 def initialize(engine, grader_process=nil)
10 10 @engine = engine
11 11 @grader_process = grader_process
12 12 end
13 13
14 14 def grade_oldest_task
15 15 task = Task.get_inqueue_and_change_status(Task::STATUS_GRADING)
16 16 if task!=nil
17 17 @grader_process.report_active(task) if @grader_process!=nil
18 18
19 19 submission = Submission.find(task.submission_id)
20 20 @engine.grade(submission)
21 21 task.status_complete!
22 22 end
23 23 return task
24 24 end
25 25
26 26 def grade_problem(problem)
27 27 users = User.find(:all)
28 28 users.each do |u|
29 29 puts "user: #{u.login}"
30 30 last_sub = Submission.find(:first,
31 31 :conditions => "user_id = #{u.id} and " +
32 - "problem_id = #{prob.id}",
32 + "problem_id = #{problem.id}",
33 33 :order => 'submitted_at DESC')
34 34 if last_sub!=nil
35 35 @engine.grade(last_sub)
36 36 end
37 37 end
38 38 end
39 39
40 40 def grade_oldest_test_request
41 41 test_request = TestRequest.get_inqueue_and_change_status(Task::STATUS_GRADING)
42 42 if test_request!=nil
43 43 @grader_process.report_active(test_request) if @grader_process!=nil
44 44
45 45 @engine.grade(test_request)
46 46 test_request.status_complete!
47 47 end
48 48 return test_request
49 49 end
50 50
51 51 end
52 52
53 53 end
54 54
You need to be logged in to leave comments. Login now