Description:
[web] allow check script to inject the comment
git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@152 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
r40:fdbf2dc47aa1 - - 1 file changed: 4 inserted, 2 deleted
@@ -15,18 +15,20 | |||||
|
15 | fp.puts("grade: #{Time.new.strftime("%H:%M")} #{str}") |
|
15 | fp.puts("grade: #{Time.new.strftime("%H:%M")} #{str}") |
|
16 | fp.close |
|
16 | fp.close |
|
17 | end |
|
17 | end |
|
18 | end |
|
18 | end |
|
19 |
|
19 | ||
|
20 | def char_comment(comment) |
|
20 | def char_comment(comment) |
|
21 |
- if comment =~ /[ |
|
21 | + if comment =~ /[Ii]ncorrect/ |
|
22 | INCORRECT_MARK |
|
22 | INCORRECT_MARK |
|
23 | elsif comment =~ /[Cc]orrect/ |
|
23 | elsif comment =~ /[Cc]orrect/ |
|
24 | CORRECT_MARK |
|
24 | CORRECT_MARK |
|
25 | elsif comment =~ /[Tt]ime/ |
|
25 | elsif comment =~ /[Tt]ime/ |
|
26 | TIMEOUT_MARK |
|
26 | TIMEOUT_MARK |
|
|
27 | + elsif res = /^[Cc]omment:(.*)$/.match(comment) | ||
|
|
28 | + res[1] | ||
|
27 | else |
|
29 | else |
|
28 | RUN_ERROR_MARK # these are run time errors |
|
30 | RUN_ERROR_MARK # these are run time errors |
|
29 | end |
|
31 | end |
|
30 | end |
|
32 | end |
|
31 |
|
33 | ||
|
32 | problem_home = ENV['PROBLEM_HOME'] |
|
34 | problem_home = ENV['PROBLEM_HOME'] |
@@ -56,13 +58,13 | |||||
|
56 | else |
|
58 | else |
|
57 | result_file = File.new(result_file_name, "r") |
|
59 | result_file = File.new(result_file_name, "r") |
|
58 | result_file_lines = result_file.readlines |
|
60 | result_file_lines = result_file.readlines |
|
59 | if result_file_lines.length>=2 |
|
61 | if result_file_lines.length>=2 |
|
60 | run_score = run_score + result_file_lines[1].to_i |
|
62 | run_score = run_score + result_file_lines[1].to_i |
|
61 | run_comment += result_file_lines[0] |
|
63 | run_comment += result_file_lines[0] |
|
62 | - run_comment_short += char_comment(result_file_lines[0]) |
|
64 | + run_comment_short += char_comment(result_file_lines[0].chomp) |
|
63 | else |
|
65 | else |
|
64 | run_comment += "result file for test #{test_num} error\n" |
|
66 | run_comment += "result file for test #{test_num} error\n" |
|
65 | run_comment_short += RUN_ERROR_MARK |
|
67 | run_comment_short += RUN_ERROR_MARK |
|
66 | log "Error in #{test_num}/result!" |
|
68 | log "Error in #{test_num}/result!" |
|
67 | end |
|
69 | end |
|
68 | result_file.close |
|
70 | result_file.close |
You need to be logged in to leave comments.
Login now