Description:
added problem_name to TestRequest and moved name_of to protected
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@88 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:b5c26b86e7d2 - - 1 file changed: 11 inserted, 4 deleted
@@ -6,9 +6,11 | |||||
|
6 | # determined. However, to be more flexible, we have to ensure that |
|
6 | # determined. However, to be more flexible, we have to ensure that |
|
7 | # it works as well with problem=nil. In this case, we shall provide |
|
7 | # it works as well with problem=nil. In this case, we shall provide |
|
8 | # a "default" execution environment for it. This can be done |
|
8 | # a "default" execution environment for it. This can be done |
|
9 |
- # seamlessly by using TestRequest# |
|
9 | + # seamlessly by using TestRequest#problem_name or |
|
10 | - # of the problem: name_of would return problem.name when |
|
10 | + # TestRequest#name_of(problem) when retrieving the name of the |
|
11 | - # problem!=nil and it would return "default" when problem=nil. |
|
11 | + # problem: #name_of would return problem.name when problem!=nil and |
|
|
12 | + # it would return "default" when problem=nil, #problem_name just | ||
|
|
13 | + # call #name_of. | ||
|
12 | # |
|
14 | # |
|
13 |
|
15 | ||
|
14 | require 'fileutils' |
|
16 | require 'fileutils' |
@@ -52,6 +54,12 | |||||
|
52 | test_request |
|
54 | test_request |
|
53 | end |
|
55 | end |
|
54 |
|
56 | ||
|
|
57 | + def problem_name | ||
|
|
58 | + TestRequest.name_of(self.problem) | ||
|
|
59 | + end | ||
|
|
60 | + | ||
|
|
61 | + protected | ||
|
|
62 | + | ||
|
55 | def self.name_of(problem) |
|
63 | def self.name_of(problem) |
|
56 | if problem!=nil |
|
64 | if problem!=nil |
|
57 | problem.name |
|
65 | problem.name |
@@ -60,7 +68,6 | |||||
|
60 | end |
|
68 | end |
|
61 | end |
|
69 | end |
|
62 |
|
70 | ||
|
63 | - protected |
|
||
|
64 | def self.input_file_name(user,problem) |
|
71 | def self.input_file_name(user,problem) |
|
65 | problem_name = TestRequest.name_of(problem) |
|
72 | problem_name = TestRequest.name_of(problem) |
|
66 | begin |
|
73 | begin |
You need to be logged in to leave comments.
Login now