https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog
from Nicolas Desprès <nicolas.despres(a)lrde.epita.fr>
No more hard code the unit name.
* web/ranch/app/controllers/graph_controller.rb: Extract the output
name and unit from the DB.
* web/ranch/test/functional/benches_controller_test.rb,
* web/ranch/app/controllers/benches_controller.rb,
* web/ranch/app/views/benches/list.rhtml: Do not give the bench id as
a parameter since it doesn't make sense to send if to the regression
graph controller.
app/controllers/benches_controller.rb | 2 +-
app/controllers/graph_controller.rb | 9 +++++----
app/views/benches/list.rhtml | 1 -
test/functional/benches_controller_test.rb | 1 -
4 files changed, 6 insertions(+), 7 deletions(-)
Index: web/ranch/test/functional/benches_controller_test.rb
--- web/ranch/test/functional/benches_controller_test.rb (revision 14)
+++ web/ranch/test/functional/benches_controller_test.rb (working copy)
@@ -22,7 +22,6 @@
assert_not_nil assigns(:project)
assert_not_nil assigns(:benches)
- assert_not_nil assigns(:benches).id
assert_equal(1,
(assigns(:benches).find_all{|x| x.name == 'determinize'}).size,
Index: web/ranch/app/controllers/graph_controller.rb
--- web/ranch/app/controllers/graph_controller.rb (revision 14)
+++ web/ranch/app/controllers/graph_controller.rb (working copy)
@@ -7,7 +7,8 @@
@bench_name = params[:bench_name]
@output_num = 1 #FIXME: manage several outputs
- values = Bench.find_by_sql "SELECT outputs.value, benches.revision " +
+ results = Bench.find_by_sql "SELECT outputs.value, outputs.name, " +
+ "outputs.unit, benches.revision " +
"FROM outputs, benches " +
"WHERE benches.project_id = #{(a)project.id} " +
"AND benches.name = '#@bench_name' " +
@@ -17,15 +18,15 @@
"AND benches.revision <= #{params[:rev_stop]} " +
"ORDER BY benches.revision"
- data = values.collect { |v| v.value.to_f }
- labels = values.collect { |v| "r#{v.revision}" }
+ data = results.collect { |v| v.value.to_f }
+ labels = results.collect { |v| "r#{v.revision}" }
filename = "regression_#{@project.name}_#@bench_name"
Tempfile.open(filename) do |f|
File.open(f.path, 'w') do |io|
Grapher.regression(io,
"#{(a)project.name}name}: #@bench_name",
- "utime(sec)", #FIXME: gather this info from the DB
+ "#{results.first.name}(#{results.first.unit})",
data,
labels)
end
Index: web/ranch/app/controllers/benches_controller.rb
--- web/ranch/app/controllers/benches_controller.rb (revision 14)
+++ web/ranch/app/controllers/benches_controller.rb (working copy)
@@ -4,7 +4,7 @@
def list
@project = Project.find_by_id(@params[:project_id])
- @benches = Bench.find_by_sql "SELECT id, name " +
+ @benches = Bench.find_by_sql "SELECT name " +
"FROM benches " +
"WHERE project_id = #{(a)project.id} " +
"GROUP BY name " +
Index: web/ranch/app/views/benches/list.rhtml
--- web/ranch/app/views/benches/list.rhtml (revision 14)
+++ web/ranch/app/views/benches/list.rhtml (working copy)
@@ -13,7 +13,6 @@
<%= link_to bench.name, :controller => "graph_form",
:action => "index",
:project_id => @project.id,
- :bench_id => bench.id,
:bench_name => bench.name %>
</td>
</tr>