Description:
added options to enable test-pair import
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r212:e6f50b45f902 - - 3 files changed: 19 inserted, 2 deleted
@@ -147,10 +147,14 | |||||
|
147 | end |
|
147 | end |
|
148 |
|
148 | ||
|
149 | def import |
|
149 | def import |
|
|
150 | + @allow_test_pair_import = allow_test_pair_import? | ||
|
150 | end |
|
151 | end |
|
151 |
|
152 | ||
|
152 | def do_import |
|
153 | def do_import |
|
153 | old_problem = Problem.find_by_name(params[:name]) |
|
154 | old_problem = Problem.find_by_name(params[:name]) |
|
|
155 | + if !allow_test_pair_import? and params.has_key? :import_to_db | ||
|
|
156 | + params.delete :import_to_db | ||
|
|
157 | + end | ||
|
154 | @problem, import_log = Problem.create_from_import_form_params(params, |
|
158 | @problem, import_log = Problem.create_from_import_form_params(params, |
|
155 | old_problem) |
|
159 | old_problem) |
|
156 |
|
160 | ||
@@ -167,6 +171,14 | |||||
|
167 | ################################## |
|
171 | ################################## |
|
168 | protected |
|
172 | protected |
|
169 |
|
173 | ||
|
|
174 | + def allow_test_pair_import? | ||
|
|
175 | + if defined? ALLOW_TEST_PAIR_IMPORT | ||
|
|
176 | + return ALLOW_TEST_PAIR_IMPORT | ||
|
|
177 | + else | ||
|
|
178 | + return false | ||
|
|
179 | + end | ||
|
|
180 | + end | ||
|
|
181 | + | ||
|
170 | def change_date_added |
|
182 | def change_date_added |
|
171 | problems = get_problems_from_params |
|
183 | problems = get_problems_from_params |
|
172 | year = params[:date_added][:year].to_i |
|
184 | year = params[:date_added][:year].to_i |
@@ -33,6 +33,7 | |||||
|
33 | %br/ |
|
33 | %br/ |
|
34 | You may put task description in *.html for raw html |
|
34 | You may put task description in *.html for raw html |
|
35 | and *.md or *.markdown for markdown. |
|
35 | and *.md or *.markdown for markdown. |
|
|
36 | + - if @allow_test_pair_import | ||
|
36 | %tr |
|
37 | %tr |
|
37 | %td |
|
38 | %td |
|
38 | %td |
|
39 | %td |
@@ -90,8 +90,9 | |||||
|
90 | # TODO: change this to where results are kept. |
|
90 | # TODO: change this to where results are kept. |
|
91 | GRADING_RESULT_DIR = 'RESULT-DIR' |
|
91 | GRADING_RESULT_DIR = 'RESULT-DIR' |
|
92 |
|
92 | ||
|
93 | - # Uncomment so that configuration is read only once when the server is loaded |
|
93 | + # Change this to allow importing testdata into database as test-pairs. |
|
94 | - # Configuration.enable_caching |
|
94 | + # This is mainly for Code Jom contest. |
|
|
95 | + ALLOW_TEST_PAIR_IMPORT = false | ||
|
95 |
|
96 | ||
|
96 | # Uncomment so that the system validates user e-mails |
|
97 | # Uncomment so that the system validates user e-mails |
|
97 | # VALIDATE_USER_EMAILS = true |
|
98 | # VALIDATE_USER_EMAILS = true |
@@ -99,3 +100,6 | |||||
|
99 | # Uncomment so that Apache X-Sendfile is used when delivering files |
|
100 | # Uncomment so that Apache X-Sendfile is used when delivering files |
|
100 | # (e.g., in /tasks/view). |
|
101 | # (e.g., in /tasks/view). |
|
101 | # USE_APACHE_XSENDFILE = true |
|
102 | # USE_APACHE_XSENDFILE = true |
|
|
103 | + | ||
|
|
104 | + # Uncomment so that configuration is read only once when the server is loaded | ||
|
|
105 | + # Configuration.enable_caching |
You need to be logged in to leave comments.
Login now