summaryrefslogtreecommitdiff
path: root/application.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2011-03-28 18:59:22 +0200
committerChristoph Helma <helma@in-silico.ch>2011-03-28 18:59:22 +0200
commit00275b79b16ad9eac071049d84606b4f39942d94 (patch)
treef40851b0d7ea9b0ac5c2b71dacc1202ca11abb11 /application.rb
parent6edd281efdd33cf8842e79135bfd3b69d0949bce (diff)
some issues from vedrins tests fixed
Diffstat (limited to 'application.rb')
-rw-r--r--application.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/application.rb b/application.rb
index fc21414..44adf89 100644
--- a/application.rb
+++ b/application.rb
@@ -70,7 +70,7 @@ get '/login' do
end
get '/models/?' do
- @models = ToxCreateModel.all#.to_a.reverse
+ @models = ToxCreateModel.all.sort(:order => "DESC")
subjectstring = session[:subjectid] ? "?subjectid=#{CGI.escape(session[:subjectid])}" : ""
haml :models, :locals=>{:models=>@models, :subjectstring => subjectstring}
end
@@ -151,7 +151,7 @@ get '/model/:id/:view/?' do
end
get '/predict/?' do
- @models = ToxCreateModel.all#.to_a.reverse
+ @models = ToxCreateModel.all.sort(:order => "DESC")
@models = @models.collect{|m| m if m.status == 'Completed'}.compact
haml :predict
end
@@ -201,7 +201,9 @@ post '/models' do # create a new model
csv = params[:file][:tempfile].read
@dataset.load_csv(csv, subjectid)
when ".xls", ".xlsx"
- @dataset.load_spreadsheet(Excel.new params[:file][:tempfile].path, subjectid)
+ excel_file = params[:file][:tempfile].path + File.extname(params[:file][:filename])
+ File.rename(params[:file][:tempfile].path, excel_file) # add extension, spreadsheet does not read files without extensions
+ @dataset.load_spreadsheet(Excel.new excel_file, subjectid)
else
error "#{params[:file][:filename]} has a unsupported file type."
end