summaryrefslogtreecommitdiff
path: root/application.rb
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2019-07-29 14:53:44 +0000
committergebele <gebele@in-silico.ch>2019-07-29 14:53:44 +0000
commit807b87cf18b42c055e62c91e31b05a728a7fdd42 (patch)
treeb60eb2572239c22715df4549a158a5c0918f09c3 /application.rb
parentfbe5a51d5c0fb8001dfbddc7ba458cf85a617282 (diff)
optimize batch table size; mute task progress js functions
Diffstat (limited to 'application.rb')
-rw-r--r--application.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/application.rb b/application.rb
index f5f3486..fa2a728 100644
--- a/application.rb
+++ b/application.rb
@@ -157,7 +157,9 @@ get '/predict/batch/download/?' do
dataset = Dataset.find task.dataset_id
name = dataset.name + ".csv"
t = Tempfile.new
- t << dataset.to_prediction_csv
+ # to_prediction_csv takes too much time; use task.csv instead which is the same
+ #t << dataset.to_prediction_csv
+ t << task.csv
t.rewind
response['Content-Type'] = "text/csv"
send_file t.path, :filename => "#{Time.now.strftime("%Y-%m-%d")}_lazar_batch_prediction_#{name}", :type => "text/csv", :disposition => "attachment"
@@ -253,21 +255,21 @@ get '/prediction/task/?' do
cansmi = 0
header.each_with_index do |h,idx|
cansmi = idx if h =~ /Canonical SMILES/
- string += "<th>#{h}</th>"
+ string += "<th class=\"fit\">#{h}</th>"
end
string += "</tr>"
string += "<tr>"
csv[pageNumber].each_with_index do |line,idx|
if idx == cansmi
c = Compound.from_smiles line
- string += "<td>#{line}</br>" \
+ string += "<td class=\"fit\">#{line}</br>" \
"<a class=\"btn btn-link\" data-id=\"link\" " \
"data-remote=\"#{to("/prediction/#{c.id}/details")}\" data-toggle=\"modal\" " \
"href=#details>" \
"#{embedded_svg(c.svg, title: "click for details")}" \
"</td>"
else
- string += "<td>#{line.numeric? && line.include?(".") ? line.to_f.signif(3) : line}</td>"
+ string += "<td nowrap>#{line.numeric? && line.include?(".") ? line.to_f.signif(3) : (line.nil? ? line : line.gsub(" ","<br />"))}</td>"
end
end
string += "</tr>"