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:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r36:79248d481294 - - 1 file changed: 1 inserted, 1 deleted
@@ -8,47 +8,47 | |||||
|
8 |
|
8 | ||
|
9 | def initialize(engine, grader_process=nil) |
|
9 | def initialize(engine, grader_process=nil) |
|
10 | @engine = engine |
|
10 | @engine = engine |
|
11 | @grader_process = grader_process |
|
11 | @grader_process = grader_process |
|
12 | end |
|
12 | end |
|
13 |
|
13 | ||
|
14 | def grade_oldest_task |
|
14 | def grade_oldest_task |
|
15 | task = Task.get_inqueue_and_change_status(Task::STATUS_GRADING) |
|
15 | task = Task.get_inqueue_and_change_status(Task::STATUS_GRADING) |
|
16 | if task!=nil |
|
16 | if task!=nil |
|
17 | @grader_process.report_active(task) if @grader_process!=nil |
|
17 | @grader_process.report_active(task) if @grader_process!=nil |
|
18 |
|
18 | ||
|
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 | end |
|
22 | end |
|
23 | return task |
|
23 | return task |
|
24 | end |
|
24 | end |
|
25 |
|
25 | ||
|
26 | def grade_problem(problem) |
|
26 | def grade_problem(problem) |
|
27 | users = User.find(:all) |
|
27 | users = User.find(:all) |
|
28 | users.each do |u| |
|
28 | users.each do |u| |
|
29 | puts "user: #{u.login}" |
|
29 | puts "user: #{u.login}" |
|
30 | last_sub = Submission.find(:first, |
|
30 | last_sub = Submission.find(:first, |
|
31 | :conditions => "user_id = #{u.id} and " + |
|
31 | :conditions => "user_id = #{u.id} and " + |
|
32 | - "problem_id = #{prob.id}", |
|
32 | + "problem_id = #{problem.id}", |
|
33 | :order => 'submitted_at DESC') |
|
33 | :order => 'submitted_at DESC') |
|
34 | if last_sub!=nil |
|
34 | if last_sub!=nil |
|
35 | @engine.grade(last_sub) |
|
35 | @engine.grade(last_sub) |
|
36 | end |
|
36 | end |
|
37 | end |
|
37 | end |
|
38 | end |
|
38 | end |
|
39 |
|
39 | ||
|
40 | def grade_oldest_test_request |
|
40 | def grade_oldest_test_request |
|
41 | test_request = TestRequest.get_inqueue_and_change_status(Task::STATUS_GRADING) |
|
41 | test_request = TestRequest.get_inqueue_and_change_status(Task::STATUS_GRADING) |
|
42 | if test_request!=nil |
|
42 | if test_request!=nil |
|
43 | @grader_process.report_active(test_request) if @grader_process!=nil |
|
43 | @grader_process.report_active(test_request) if @grader_process!=nil |
|
44 |
|
44 | ||
|
45 | @engine.grade(test_request) |
|
45 | @engine.grade(test_request) |
|
46 | test_request.status_complete! |
|
46 | test_request.status_complete! |
|
47 | end |
|
47 | end |
|
48 | return test_request |
|
48 | return test_request |
|
49 | end |
|
49 | end |
|
50 |
|
50 | ||
|
51 | end |
|
51 | end |
|
52 |
|
52 | ||
|
53 | end |
|
53 | end |
|
54 |
|
54 |
You need to be logged in to leave comments.
Login now