summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormr <mr@mrautenberg.de>2011-02-11 16:49:13 +0100
committermr <mr@mrautenberg.de>2011-02-11 16:49:13 +0100
commit50a06e7077681317bcf0da4fc4aa6ff36c19e4a3 (patch)
treeff655daef56b6dbd4879af411c1b0b7835f65f5e
parent1f0b19023c2a308c21f9ddcf456053bf5b7ecb32 (diff)
refining task_uri query
-rw-r--r--application.rb25
-rw-r--r--views/lazar.haml2
-rw-r--r--views/model.haml3
3 files changed, 17 insertions, 13 deletions
diff --git a/application.rb b/application.rb
index ab6eb46..a36252b 100644
--- a/application.rb
+++ b/application.rb
@@ -96,14 +96,18 @@ end
get '/model/:id/progress/?' do
response['Content-Type'] = 'text/plain'
model = ToxCreateModel.get(params[:id])
- if (task = OpenTox::Task.exist?(model.task_uri))
- task = OpenTox::Task.exist?(model.task_uri)
- percentage_completed = task.metadata[OT.percentageCompleted]
- end
- begin
- haml :model_progress, :locals=>{:percentage_completed=>percentage_completed}, :layout => false
- rescue
- return "unavailable"
+ if model.task_uri
+ if (task = OpenTox::Task.exist?(model.task_uri))
+ task = OpenTox::Task.exist?(model.task_uri)
+ percentage_completed = task.percentageCompleted
+ end
+ begin
+ haml :model_progress, :locals=>{:percentage_completed=>percentage_completed}, :layout => false
+ rescue
+ return "unavailable"
+ end
+ else
+ return ""
end
end
@@ -256,7 +260,6 @@ post '/models' do # create a new model
unless url_for("",:full).match(/localhost/)
@model.update :status => "Validating model"
- LOGGER.debug "mr ::: #{lazar.metadata.inspect}"
begin
validation = OpenTox::Crossvalidation.create(
{:algorithm_uri => lazar.metadata[OT.algorithm],
@@ -341,8 +344,8 @@ post '/predict/?' do # post chemical name to model
title = nil
db_activities = []
lazar = OpenTox::Model::Lazar.new model.uri
- prediction_dataset_uri = lazar.run(:compound_uri => @compound.uri, :subjectid => session[:subjectid])
- prediction_dataset = OpenTox::LazarPrediction.find(prediction_dataset_uri, session[:subjectid])
+ prediction_dataset_uri = lazar.run({:compound_uri => @compound.uri, :subjectid => subjectid})
+ prediction_dataset = OpenTox::LazarPrediction.find(prediction_dataset_uri, subjectid)
if prediction_dataset.metadata[OT.hasSource].match(/dataset/)
@predictions << {
:title => model.name,
diff --git a/views/lazar.haml b/views/lazar.haml
index a46f82c..9d9145e 100644
--- a/views/lazar.haml
+++ b/views/lazar.haml
@@ -55,4 +55,4 @@
= haml :feature_table, :locals => {:features => sort(@prediction.descriptors(@compound))}, :layout => false
%tbody#neighbors
- = haml :neighbors, :locals => {:neighbors => @prediction.neighbors(@compound), :page => @page}, :layout => :false
+ = haml :neighbors, :locals => {:neighbors => @prediction.neighbors(@compound), :page => @page}, :layout => false
diff --git a/views/model.haml b/views/model.haml
index 340d29e..8112dd6 100644
--- a/views/model.haml
+++ b/views/model.haml
@@ -14,8 +14,9 @@
%dd
%span{:id => "model_#{model.id}_status", :class => "model_status"}
= haml :model_status, :locals=>{:model=>model}, :layout => false
- - if model.task_uri && model.status !~ /Completed|Cancelled|Error/
+ - if model.task_uri && model.status !~ /Completed|Cancelled|Error|Deleting/
- if (task = OpenTox::Task.exist?(model.task_uri))
+ %input{:type => 'hidden', :id => "model_#{model.id}_task", :value => "#{model.task_uri}"}
- percentage_completed = task.metadata[OT.percentageCompleted].to_i
- js = "$('#model_#{model.id}_progress').progressbar({ value: #{percentage_completed} })";
:javascript