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:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r68:fd3aca136ef8 - - 1 file changed: 1 inserted, 4 deleted
@@ -7,52 +7,49 | |||||
|
7 | class Runner |
|
7 | class Runner |
|
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 | @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( |
|
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 |
|
47 | test_request = TestRequest.get_inqueue_and_change_status(Task::STATUS_GRADING) |
|
44 | test_request = TestRequest.get_inqueue_and_change_status(Task::STATUS_GRADING) |
|
48 | if test_request!=nil |
|
45 | if test_request!=nil |
|
49 | @grader_process.report_active(test_request) if @grader_process!=nil |
|
46 | @grader_process.report_active(test_request) if @grader_process!=nil |
|
50 |
|
47 | ||
|
51 | @engine.grade(test_request) |
|
48 | @engine.grade(test_request) |
|
52 | test_request.status_complete! |
|
49 | test_request.status_complete! |
|
53 | @grader_process.report_inactive(test_request) if @grader_process!=nil |
|
50 | @grader_process.report_inactive(test_request) if @grader_process!=nil |
|
54 | end |
|
51 | end |
|
55 | return test_request |
|
52 | return test_request |
|
56 | end |
|
53 | end |
|
57 |
|
54 | ||
|
58 | end |
|
55 | end |
You need to be logged in to leave comments.
Login now