Description:
git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@237 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

r56:17b93a2be7ca - - 1 file changed: 1 inserted, 1 deleted

@@ -50,68 +50,68
50 50 cmp_msg_fname = "#{test_result_dir}/compiler_message"
51 51 if FileTest.exist?(cmp_msg_fname)
52 52 cmp_file = File.open(cmp_msg_fname)
53 53 cmp_msg = cmp_file.read
54 54 cmp_file.close
55 55 else
56 56 cmp_msg = ""
57 57 end
58 58
59 59 result_fname = "#{test_result_dir}/result"
60 60 comment_fname = "#{test_result_dir}/comment"
61 61 if FileTest.exist?(result_fname)
62 62 comment = ""
63 63 begin
64 64 result_file = File.open(result_fname)
65 65 result = result_file.readline.to_i
66 66 result_file.close
67 67 rescue
68 68 result = 0
69 69 comment = "error reading result file."
70 70 end
71 71
72 72 begin
73 73 comment_file = File.open(comment_fname)
74 74 comment += comment_file.readline.chomp
75 75 comment_file.close
76 76 rescue
77 77 comment += ""
78 78 end
79 79
80 80 return {:points => result,
81 81 :comment => comment,
82 82 :cmp_msg => cmp_msg}
83 83 else
84 84 if FileTest.exist?("#{test_result_dir}/a.out")
85 85 return {:points => 0,
86 86 :comment => 'error during grading',
87 87 :cmp_msg => cmp_msg}
88 88 else
89 89 return {:points => 0,
90 90 :comment => 'compilation error',
91 91 :cmp_msg => cmp_msg}
92 92 end
93 93 end
94 94 end
95 95
96 96 def save_result(submission,result)
97 97 problem = submission.problem
98 - submission.graded_at = Time.now
98 + submission.graded_at = Time.now.gmtime
99 99 points = result[:points]
100 100 submission.points = points
101 101 comment = @config.report_comment(result[:comment])
102 102 if problem == nil
103 103 submission.grader_comment = 'PASSED: ' + comment + '(problem is nil)'
104 104 elsif points == problem.full_score
105 105 submission.grader_comment = 'PASSED: ' + comment
106 106 elsif result[:comment].chomp =~ /^[\[\]P]+$/
107 107 submission.grader_comment = 'PASSED: ' + comment + '(inconsistent score)'
108 108 else
109 109 submission.grader_comment = 'FAILED: ' + comment
110 110 end
111 111 submission.compiler_message = result[:cmp_msg] or ''
112 112 submission.save
113 113 end
114 114
115 115 end
116 116
117 117 end
You need to be logged in to leave comments. Login now