Description:
add selectable checker (for now, only 'text' and 'float') in the problem import
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r402:7f3e18dca393 - - 4 files changed: 25 inserted, 3 deleted
@@ -43,6 +43,7 | |||
|
43 | 43 | if not importer.import_from_file(import_params[:file], |
|
44 | 44 | import_params[:time_limit], |
|
45 | 45 | import_params[:memory_limit], |
|
46 | + import_params[:checker_name], | |
|
46 | 47 | import_to_db) |
|
47 | 48 | problem.errors.add_to_base('Import error.') |
|
48 | 49 | end |
@@ -90,6 +91,11 | |||
|
90 | 91 | problem.errors.add_to_base('No testdata file.') |
|
91 | 92 | end |
|
92 | 93 | |
|
94 | + checker_name = 'text' | |
|
95 | + if ['text','float'].include? params[:checker] | |
|
96 | + checker_name = params[:checker] | |
|
97 | + end | |
|
98 | + | |
|
93 | 99 | file = params[:file] |
|
94 | 100 | |
|
95 | 101 | if !problem.errors.empty? |
@@ -106,7 +112,8 | |||
|
106 | 112 | return [{ |
|
107 | 113 | :time_limit => time_limit, |
|
108 | 114 | :memory_limit => memory_limit, |
|
109 | - :file => file | |
|
115 | + :file => file, | |
|
116 | + :checker_name => checker_name | |
|
110 | 117 | }, |
|
111 | 118 | problem] |
|
112 | 119 | end |
@@ -32,6 +32,19 | |||
|
32 | 32 | %br/ |
|
33 | 33 | You may put task description in *.html for raw html |
|
34 | 34 | and *.md or *.markdown for markdown. |
|
35 | + %br/ | |
|
36 | + You may also put a pdf file for the task description | |
|
37 | + %tr | |
|
38 | + %td Checker: | |
|
39 | + %td= select_tag 'checker', options_for_select([['Text checker','text'],['Float checker','float']], 'text') | |
|
40 | + %tr | |
|
41 | + %td | |
|
42 | + %td | |
|
43 | + %span{:class => 'help'} | |
|
44 | + "Text" checker checks if the text (including numbers) is the same, ignoring any whitespace | |
|
45 | + %br/ | |
|
46 | + "Float" checker checks if all numbers is within EPSILON error using formula |a-b| < EPSILON * max(|a|,|b|) | |
|
47 | + | |
|
35 | 48 | - if @allow_test_pair_import |
|
36 | 49 | %tr |
|
37 | 50 | %td |
@@ -50,7 +50,7 | |||
|
50 | 50 | |
|
51 | 51 | Dir.chdir(cur_dir) |
|
52 | 52 | |
|
53 | - return output | |
|
53 | + return "import CMD: #{cmd}\n" + output | |
|
54 | 54 | end |
|
55 | 55 | return '' |
|
56 | 56 | end |
@@ -11,6 +11,7 | |||
|
11 | 11 | def import_from_file(tempfile, |
|
12 | 12 | time_limit, |
|
13 | 13 | memory_limit, |
|
14 | + checker_name='text', | |
|
14 | 15 | import_to_db=false) |
|
15 | 16 | |
|
16 | 17 | dirname = extract(tempfile) |
@@ -19,7 +20,8 | |||
|
19 | 20 | @log_msg = GraderScript.call_import_problem(@problem.name, |
|
20 | 21 | dirname, |
|
21 | 22 | time_limit, |
|
22 |
- memory_limit |
|
|
23 | + memory_limit, | |
|
24 | + checker_name) | |
|
23 | 25 | else |
|
24 | 26 | # Import test data to test pairs. |
|
25 | 27 |
You need to be logged in to leave comments.
Login now