https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog
from Nicolas Despr�s <nicolas.despres(a)gmail.com>
Draw all outputs in one page.
* web/ranch/test/functional/graph_form_controller_test.rb: Test it.
* web/ranch/app/controllers/graph_form_controller.rb: Request the
number of output of the selected bench.
* web/ranch/app/views/graph_form/index.rhtml: Draw the regression
graph for each output of the bench.
app/controllers/graph_form_controller.rb | 10 ++++++++++
app/views/graph_form/index.rhtml | 9 +++++++++
test/functional/graph_form_controller_test.rb | 3 ++-
3 files changed, 21 insertions(+), 1 deletion(-)
Index: web/ranch/test/functional/graph_form_controller_test.rb
--- web/ranch/test/functional/graph_form_controller_test.rb (revision 19)
+++ web/ranch/test/functional/graph_form_controller_test.rb (working copy)
@@ -5,7 +5,7 @@
class GraphFormController; def rescue_action(e) raise e end; end
class GraphFormControllerTest < Test::Unit::TestCase
- fixtures :projects, :benches
+ fixtures :projects, :benches, :outputs
def setup
@controller = GraphFormController.new
@@ -87,6 +87,7 @@
assert_equal 1, assigns(:project).id
assert_equal 'determinize', assigns(:bench_name)
assert_equal 0, assigns(:output_arg_num)
+ assert_equal 3, assigns(:output_arg_nb)
end
end
Index: web/ranch/app/controllers/graph_form_controller.rb
--- web/ranch/app/controllers/graph_form_controller.rb (revision 19)
+++ web/ranch/app/controllers/graph_form_controller.rb (working copy)
@@ -20,6 +20,16 @@
@bench_name = params[:bench_name]
@project = Project.find params[:project_id]
@output_arg_num = params[:output_arg_num].to_i
+ if @output_arg_num.zero?
+ @output_arg_nb = Output.find_by_sql "SELECT outputs.arg_num " +
+ "FROM outputs, benches " +
+ "WHERE benches.project_id = #{(a)project.id} " +
+ "AND benches.name = '#@bench_name' " +
+ "AND outputs.bench_id = benches.id " +
+ "GROUP BY outputs.arg_num " +
+ "ORDER BY outputs.arg_num "
+ @output_arg_nb = @output_arg_nb.size
+ end
@draw_on = true
@revision = params[:revision]
head_rev = @project.head_revision
Index: web/ranch/app/views/graph_form/index.rhtml
--- web/ranch/app/views/graph_form/index.rhtml (revision 19)
+++ web/ranch/app/views/graph_form/index.rhtml (working copy)
@@ -29,8 +29,17 @@
<%= end_form_tag %>
<% if @draw_on %>
+ <% if @output_arg_num.zero? %>
+ <% 1.upto(@output_arg_nb) do |i| %>
+ <p>
+ <%= graph_reg_tag @project.id, @bench_name,
+ @revision[:start], @revision[:stop], i %>
+ </p>
+ <% end %>
+ <% else %>
<%= graph_reg_tag @project.id, @bench_name,
@revision[:start], @revision[:stop], @output_arg_num %>
+ <% end %>
<% else %>
<%= content_tag "p", "No chart to display - click on Draw"
%>
<% end %>