Description:
removed extra puts in testdata import
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r239:b65b6924abe8 - - 1 file changed: 0 inserted, 2 deleted

@@ -78,50 +78,48
78 testdata_filename = File.join(Dir.tmpdir,"#{@problem.name}#{ext}")
78 testdata_filename = File.join(Dir.tmpdir,"#{@problem.name}#{ext}")
79
79
80 return nil if tempfile==""
80 return nil if tempfile==""
81
81
82 if tempfile.instance_of?(Tempfile)
82 if tempfile.instance_of?(Tempfile)
83 tempfile.close
83 tempfile.close
84 FileUtils.move(tempfile.path,testdata_filename)
84 FileUtils.move(tempfile.path,testdata_filename)
85 else
85 else
86 File.open(testdata_filename, "wb") do |f|
86 File.open(testdata_filename, "wb") do |f|
87 f.write(tempfile.read)
87 f.write(tempfile.read)
88 end
88 end
89 end
89 end
90
90
91 return testdata_filename
91 return testdata_filename
92 end
92 end
93
93
94 def import_test_pairs(dirname)
94 def import_test_pairs(dirname)
95 test_num = 1
95 test_num = 1
96 while FileTest.exists? "#{dirname}/#{test_num}.in"
96 while FileTest.exists? "#{dirname}/#{test_num}.in"
97 in_filename = "#{dirname}/#{test_num}.in"
97 in_filename = "#{dirname}/#{test_num}.in"
98 sol_filename = "#{dirname}/#{test_num}.sol"
98 sol_filename = "#{dirname}/#{test_num}.sol"
99
99
100 break if not FileTest.exists? sol_filename
100 break if not FileTest.exists? sol_filename
101
101
102 - puts "#{dirname}"
103 -
104 test_pair = TestPair.new(:input => open(in_filename).read,
102 test_pair = TestPair.new(:input => open(in_filename).read,
105 :solution => open(sol_filename).read,
103 :solution => open(sol_filename).read,
106 :number => test_num,
104 :number => test_num,
107 :problem => @problem)
105 :problem => @problem)
108 break if not test_pair.save
106 break if not test_pair.save
109
107
110 test_num += 1
108 test_num += 1
111 end
109 end
112 return test_num > 1
110 return test_num > 1
113 end
111 end
114
112
115 def import_problem_description(dirname)
113 def import_problem_description(dirname)
116 html_files = Dir["#{dirname}/*.html"]
114 html_files = Dir["#{dirname}/*.html"]
117 markdown_files = Dir["#{dirname}/*.md"] + Dir["#{dirname}/*.markdown"]
115 markdown_files = Dir["#{dirname}/*.md"] + Dir["#{dirname}/*.markdown"]
118 if (html_files.length != 0) or (markdown_files.length != 0)
116 if (html_files.length != 0) or (markdown_files.length != 0)
119 description = @problem.description || Description.new
117 description = @problem.description || Description.new
120
118
121 if html_files.length != 0
119 if html_files.length != 0
122 filename = html_files[0]
120 filename = html_files[0]
123 description.markdowned = false
121 description.markdowned = false
124 else
122 else
125 filename = markdown_files[0]
123 filename = markdown_files[0]
126 description.markdowned = true
124 description.markdowned = true
127 end
125 end
You need to be logged in to leave comments. Login now