summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2011-03-28 19:00:18 +0200
committerChristoph Helma <helma@in-silico.ch>2011-03-28 19:00:18 +0200
commitefde82221b6159e6c062aa5c164296ba0a220890 (patch)
treef40851b0d7ea9b0ac5c2b71dacc1202ca11abb11
parent6edd281efdd33cf8842e79135bfd3b69d0949bce (diff)
parent00275b79b16ad9eac071049d84606b4f39942d94 (diff)
Merge branch 'hotfix/v1.0.4'
-rw-r--r--application.rb8
-rw-r--r--views/layout.haml2
-rw-r--r--views/neighbors.haml1
-rw-r--r--views/neighbors_navigation.haml7
4 files changed, 12 insertions, 6 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
diff --git a/views/layout.haml b/views/layout.haml
index d9d7783..cdabe43 100644
--- a/views/layout.haml
+++ b/views/layout.haml
@@ -37,7 +37,7 @@
- if `hostname`.match(/ot-test/)
.notice
This service is for testing purposes only - once a week all models will be deleted. Please send bug reports and feature requests to our
- %a{:href => 'http://github.com/opentox/opentox-toxmodel/issues'} issue tracker.
+ %a{:href => 'http://github.com/opentox/toxcreate/issues'} issue tracker.
- if flash[:notice]
%p
diff --git a/views/neighbors.haml b/views/neighbors.haml
index 87fef13..b507da0 100644
--- a/views/neighbors.haml
+++ b/views/neighbors.haml
@@ -9,7 +9,6 @@
- first = 5*page
- last = first+4
- neighbor_id = 0
--# LOGGER.debug neighbors.to_yaml
- neighbors.sort{|a,b| b[OT.similarity] <=> a[OT.similarity]}[first..last].each do |neighbor|
- neighbor_id += 1
- compound = OpenTox::Compound.new(neighbor[OT.compound])
diff --git a/views/neighbors_navigation.haml b/views/neighbors_navigation.haml
index bf5ebb3..074b62c 100644
--- a/views/neighbors_navigation.haml
+++ b/views/neighbors_navigation.haml
@@ -8,7 +8,12 @@
#prev= "prev" unless @page.to_i == 0
- = "(#{5*@page+1}-#{5*@page+5}/#{@prediction.neighbors(@compound).size})"
+ - if @prediction.neighbors(@compound).size < 5*@page+5
+ - last = @prediction.neighbors(@compound).size
+ - else
+ - last = 5*@page+5
+
+ = "(#{5*@page+1}-#{last}/#{@prediction.neighbors(@compound).size})"
#next= "next" unless 5*@page.to_i+5 >= @prediction.neighbors(@compound).size