Description:
fixed import error (thanks K.Siththa)
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r274:25b80877ebce - - 1 file changed: 2 inserted, 0 deleted

@@ -124,28 +124,30
124 else
124 else
125 filename = markdown_files[0]
125 filename = markdown_files[0]
126 description.markdowned = true
126 description.markdowned = true
127 end
127 end
128
128
129 description.body = open(filename).read
129 description.body = open(filename).read
130 description.save
130 description.save
131 @problem.description = description
131 @problem.description = description
132 @problem.save
132 @problem.save
133 return "\nProblem description imported from #{filename}."
133 return "\nProblem description imported from #{filename}."
134 else
134 else
135 return ''
135 return ''
136 end
136 end
137 end
137 end
138
138
139 def import_problem_pdf(dirname)
139 def import_problem_pdf(dirname)
140 pdf_files = Dir["#{dirname}/*.pdf"]
140 pdf_files = Dir["#{dirname}/*.pdf"]
141 if pdf_files.length != 0
141 if pdf_files.length != 0
142 filename = pdf_files[0]
142 filename = pdf_files[0]
143 out_filename = "#{Problem.download_file_basedir}/#{@problem.name}.pdf"
143 out_filename = "#{Problem.download_file_basedir}/#{@problem.name}.pdf"
144 File.rename(filename, out_filename)
144 File.rename(filename, out_filename)
145 @problem.description_filename = "#{@problem.name}.pdf"
145 @problem.description_filename = "#{@problem.name}.pdf"
146 @problem.save
146 @problem.save
147 return "\nProblem pdf imported from #{filename}."
147 return "\nProblem pdf imported from #{filename}."
148 + else
149 + return ""
148 end
150 end
149 end
151 end
150
152
151 end
153 end
You need to be logged in to leave comments. Login now