Description:
merge to java
Commit status:
[Not Reviewed]
References:
merge java
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r404:e5811929f1d4 - - 1 file changed: 7 inserted, 2 deleted

@@ -154,32 +154,37
154 @problem.save if not @problem.id
154 @problem.save if not @problem.id
155 out_dirname = "#{Problem.download_file_basedir}/#{@problem.id}"
155 out_dirname = "#{Problem.download_file_basedir}/#{@problem.id}"
156 if not FileTest.exists? out_dirname
156 if not FileTest.exists? out_dirname
157 Dir.mkdir out_dirname
157 Dir.mkdir out_dirname
158 end
158 end
159
159
160 out_filename = "#{out_dirname}/#{@problem.name}.pdf"
160 out_filename = "#{out_dirname}/#{@problem.name}.pdf"
161
161
162 if FileTest.exists? out_filename
162 if FileTest.exists? out_filename
163 File.delete out_filename
163 File.delete out_filename
164 end
164 end
165
165
166 File.rename(filename, out_filename)
166 File.rename(filename, out_filename)
167 @problem.description_filename = "#{@problem.name}.pdf"
167 @problem.description_filename = "#{@problem.name}.pdf"
168 @problem.save
168 @problem.save
169 return "\nProblem pdf imported from #{filename}."
169 return "\nProblem pdf imported from #{filename}."
170 else
170 else
171 return ""
171 return ""
172 end
172 end
173 end
173 end
174
174
175 #just set the full score to the total number of test case
175 #just set the full score to the total number of test case
176 #it is not perfect but works on most normal use case
176 #it is not perfect but works on most normal use case
177 def import_full_score(dirname)
177 def import_full_score(dirname)
178 - in_file = Dir["#{dirname}/*.in"]
178 + num = 0
179 - full_score =in_file.length * 10
179 + loop do
180 + num += 1
181 + in_file = Dir["#{dirname}/#{num}*.in"]
182 + break if in_file.length == 0
183 + end
184 + full_score = (num - 1) * 10
180 @problem.full_score = full_score
185 @problem.full_score = full_score
181 @problem.save
186 @problem.save
182 return "\nFull score is set to #{full_score}."
187 return "\nFull score is set to #{full_score}."
183 end
188 end
184
189
185 end
190 end
You need to be logged in to leave comments. Login now