Description:
updated test_request.rb to work with grader git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@92 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

r43:305f703e60aa - - 1 file changed: 10 inserted, 6 deleted

@@ -23,6 +23,14
23 23 belongs_to :problem
24 24 belongs_to :submission
25 25
26 + def problem_name
27 + TestRequest.name_of(self.problem)
28 + end
29 +
30 + def language
31 + self.submission.language
32 + end
33 +
26 34 def self.get_inqueue_and_change_status(status)
27 35 # since there will be only one grader grading TestRequest
28 36 # we do not need locking (hopefully)
@@ -54,10 +62,6
54 62 test_request
55 63 end
56 64
57 - def problem_name
58 - TestRequest.name_of(self.problem)
59 - end
60 -
61 65 protected
62 66
63 67 def self.name_of(problem)
@@ -68,7 +72,7
68 72 end
69 73 end
70 74
71 - def self.input_file_name(user,problem)
75 + def self.random_input_file_name(user,problem)
72 76 problem_name = TestRequest.name_of(problem)
73 77 begin
74 78 tmpname = TEST_REQUEST_INPUT_FILE_DIR + "/#{user.login}/#{problem_name}/#{rand(10000)}"
@@ -77,7 +81,7
77 81 end
78 82
79 83 def self.save_input_file(tempfile, user, problem)
80 - new_file_name = input_file_name(user,problem)
84 + new_file_name = random_input_file_name(user,problem)
81 85 dirname = File.dirname(new_file_name)
82 86 FileUtils.mkdir_p(File.dirname(new_file_name)) if !File.exists?(dirname)
83 87 if tempfile.instance_of?(Tempfile)
You need to be logged in to leave comments. Login now