summaryrefslogtreecommitdiff
path: root/application.rb
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2019-08-09 12:28:19 +0000
committergebele <gebele@in-silico.ch>2019-08-09 12:28:19 +0000
commit74332693fed1d5ecb695dd6ae0c2fc611d14c4d7 (patch)
treefb5966afb8a65292b30dc5f65cd6408f7e82b560 /application.rb
parent498ad82d2cc8582d3139bf69a0fe333d6b425668 (diff)
do not delete batch tr_dataset if one of model tr_dataset;error message if dataset has no compounds
Diffstat (limited to 'application.rb')
-rw-r--r--application.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/application.rb b/application.rb
index 246efe1..064c488 100644
--- a/application.rb
+++ b/application.rb
@@ -184,7 +184,7 @@ post '/predict/?' do
raise "Wrong file extension for '#{params[:fileselect][:filename]}'. Please upload a CSV file."
end
@filename = params[:fileselect][:filename]
- File.open('tmp/' + params[:fileselect][:filename], "w") do |f|
+ File.open('tmp/' + @filename, "w") do |f|
f.write(params[:fileselect][:tempfile].read)
end
# check CSV structure by parsing and header check
@@ -198,6 +198,7 @@ post '/predict/?' do
unless params[:batchfile].blank?
dataset = Dataset.from_csv_file File.join("tmp", params[:batchfile])
+ raise "No compounds in Dataset. Please read the <a href='https://dg.in-silico.ch/predict/help' rel='external'> HELP </a> page." if dataset.compounds.size == 0
response['Content-Type'] = "application/json"
return {:dataset_id => dataset.id.to_s, :models => params[:models]}.to_json
end
@@ -233,7 +234,6 @@ post '/predict/?' do
maintask[:subTasks] = @tasks.collect{|t| t.id}
maintask.save
@pid = maintask.pid
- File.delete File.join(dataset.source)
response['Content-Type'] = "text/html"
return haml :batch
else