LRE
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
List overview
Download
Projects
November 2005
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
projects@lrde.epita.fr
6 participants
85 discussions
Start a n
N
ew thread
[ranch] 46: Start to change the main layout.
by Nicolas Despr�s
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog from Nicolas Despr�s <nicolas.despres(a)gmail.com> Start to change the main layout. * web/ranch/test/functional/projects_controller_test.rb: Test the index request. * web/ranch/app/controllers/ranch_controller.rb, * web/ranch/app/controllers/projects_controller.rb: Change the layout. * web/ranch/app/views/layouts/_menubar.rhtml: Add the projects item. * web/ranch/app/views/layouts/projects.rhtml: New. Layout for the projects controller. * web/ranch/app/views/projects/_list.rhtml: New. Left margin of project layout that list all the project. * web/ranch/app/views/projects/show.rhtml: Test whether there is a project to show. app/controllers/projects_controller.rb | 14 ++++++++++++-- app/controllers/ranch_controller.rb | 4 +--- app/views/layouts/_menubar.rhtml | 5 ++--- app/views/layouts/projects.rhtml | 28 ++++++++++++++++++++++++++++ app/views/projects/_list.rhtml | 16 ++++++++++++++++ app/views/projects/show.rhtml | 6 ++++++ test/functional/projects_controller_test.rb | 10 ++++++++++ 7 files changed, 75 insertions(+), 8 deletions(-) Index: web/ranch/test/functional/projects_controller_test.rb --- web/ranch/test/functional/projects_controller_test.rb (revision 45) +++ web/ranch/test/functional/projects_controller_test.rb (working copy) @@ -13,11 +13,21 @@ @response = ActionController::TestResponse.new end + def test_index + get :index + assert_response :redirect + assert_redirected_to(:controller => 'projects', + :action => 'show', + :project_id => 2) + assert_not_nil assigns(:projects) + end + def test_show get :show, { :project_id => 1 } assert_response :success assert_template 'show' assert_not_nil assigns(:project) + assert_not_nil assigns(:projects) end end Index: web/ranch/app/controllers/ranch_controller.rb --- web/ranch/app/controllers/ranch_controller.rb (revision 45) +++ web/ranch/app/controllers/ranch_controller.rb (working copy) @@ -1,8 +1,6 @@ class RanchController < ApplicationController - layout 'ranch_benches_list' - - before_filter LoadProjectsFilter + layout 'ranch' def index end Index: web/ranch/app/controllers/projects_controller.rb --- web/ranch/app/controllers/projects_controller.rb (revision 45) +++ web/ranch/app/controllers/projects_controller.rb (working copy) @@ -1,11 +1,21 @@ class ProjectsController < ApplicationController - layout 'ranch_benches_list' + layout 'projects' - before_filter LoadProjectsFilter + before_filter :list + + def index + redirect_to :action => 'show', :project_id => @projects.first.id + end def show @project = Project.find_by_id params[:project_id] end + protected + + def list + @projects = Project.find :all, :select => 'id, name', :order => 'name' + end + end Index: web/ranch/app/views/layouts/_menubar.rhtml --- web/ranch/app/views/layouts/_menubar.rhtml (revision 45) +++ web/ranch/app/views/layouts/_menubar.rhtml (working copy) @@ -3,9 +3,8 @@ <div style="text-align: center;"> <table class=menubar align=center valign=top> <tr> - <td> - <%= link_to "Home", :controller => "ranch", :action => "index" %> - </td> + <td><%= link_to "Home", :controller => "ranch" %></td> + <td><%= link_to "Projects", :controller => "projects" %></td> </tr> </table> <hr> Index: web/ranch/app/views/layouts/projects.rhtml --- web/ranch/app/views/layouts/projects.rhtml (revision 0) +++ web/ranch/app/views/layouts/projects.rhtml (revision 0) @@ -0,0 +1,28 @@ + <!-- -*- html -*- --> + +<html> + <%= render :partial => "layouts/head" %> + <body> + <%= render :partial => "layouts/top_banner" %> + <%= render :partial => "layouts/menubar" %> + + <p> + <table cellspacing=0 cellpadding=0 border=0 width='100%' height="80%" cols=2> + <tr> + <td class=left_margin valign=top width="15%"> + <%= render :partial => "projects/list" %> + </td> + <td class=content align=left valign=top width="80%"> + + <%= @content_for_layout %> + + </td> + </tr> + </table> + </p> + + <%= render :partial => "layouts/bottom_banner" %> + </body> +</html> + + Index: web/ranch/app/views/projects/_list.rhtml --- web/ranch/app/views/projects/_list.rhtml (revision 0) +++ web/ranch/app/views/projects/_list.rhtml (revision 0) @@ -0,0 +1,16 @@ + <!-- -*- html -*- --> +<table> + <% if @projects.nil? or @projects.empty? %> + No projects available. + <% else %> + <% for project in @projects %> + <tr> + <td> + <%= link_to project.name, :controller => "projects", + :action => "show", + :project_id => project.id %> + </td> + </tr> + <% end %> + <% end %> +</table> Index: web/ranch/app/views/projects/show.rhtml --- web/ranch/app/views/projects/show.rhtml (revision 45) +++ web/ranch/app/views/projects/show.rhtml (working copy) @@ -1,5 +1,9 @@ <!-- -*- html -*- --> +<% if @project.nil? %> + No project to show +<% else %> + <%= content_tag "h3", "#{(a)project.name}" %> <p> @@ -10,3 +14,5 @@ </tr> </table> </p> + +<% end %> \ No newline at end of file
19 years, 1 month
1
0
0
0
[ranch] 45: Remove useless file.
by Nicolas Despr�s
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog from Nicolas Despr�s <nicolas.despres(a)gmail.com> Remove useless file. * web/ranch/app/views/layouts/_banner.rhtml: Remove. 0 files changed
19 years, 1 month
1
0
0
0
[ranch] 44: Change error messages position.
by Nicolas Despr�s
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog from Nicolas Despr�s <nicolas.despres(a)gmail.com> Change error messages position. * web/ranch/app/views/graph_form/draw.rhtml: Display error messages at the same place that the graph. draw.rhtml | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) Index: web/ranch/app/views/graph_form/draw.rhtml --- web/ranch/app/views/graph_form/draw.rhtml (revision 43) +++ web/ranch/app/views/graph_form/draw.rhtml (working copy) @@ -67,7 +67,6 @@ </table> </p> -<p style="color: red;"><%= flash[:error] %></p> <p><%= submit_tag "Draw" %></p> <%= end_form_tag %> @@ -90,6 +89,10 @@ @output_arg_num, @input_set_num %> <% end %> <% else %> + <% if flash[:error] %> + <p style="color: red;"><%= flash[:error] %></p> + <% else %> <%= content_tag "p", "No chart to display - click on Draw" %> <% end %> +<% end %>
19 years, 1 month
1
0
0
0
[ranch] 43: Update test case.
by Nicolas Despr�s
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog from Nicolas Despr�s <nicolas.despres(a)gmail.com> Update test case. * web/ranch/test/functional/graph_form_controller_test.rb: Update the test cases to fit to the view new name. Test the bad revision format issue. graph_form_controller_test.rb | 32 ++++++++++++++++++++++++-------- 1 files changed, 24 insertions(+), 8 deletions(-) Index: web/ranch/test/functional/graph_form_controller_test.rb --- web/ranch/test/functional/graph_form_controller_test.rb (revision 42) +++ web/ranch/test/functional/graph_form_controller_test.rb (working copy) @@ -16,7 +16,7 @@ def test_index get :index, { :bench_id => 1 } assert_response :success - assert_template 'index' + assert_template 'draw' assert_not_nil assigns(:project) assert_not_nil assigns(:bench) @@ -31,10 +31,10 @@ def test_draw_regular_revision_range post :draw, { :bench_id => 1, - :revision => { :start => 2, :stop => 8 } + :revision => { :range => "2-8" } } assert_response :success - assert_template 'index' + assert_template 'draw' assert_not_nil assigns(:project) assert_not_nil assigns(:bench) @@ -50,10 +50,10 @@ def test_draw_bad_revision_range post :draw, { :bench_id => 1, - :revision => { :start => -42, :stop => 500 } + :revision => { :range => "-42-500" } } assert_response :success - assert_template 'index' + assert_template 'draw' assert_not_nil assigns(:project) assert_not_nil assigns(:bench) @@ -69,7 +69,7 @@ def test_draw_start_sup_stop post :draw, { :bench_id => 1, - :revision => { :start => 42, :stop => 10 } + :revision => { :range => "42-10" } } assert_response :redirect assert_redirected_to :action => 'index' @@ -85,11 +85,11 @@ def test_draw_output_arg_num post :draw, { :bench_id => 1, - :revision => { :start => 1, :stop => 10 }, + :revision => { :range => "1-10" }, :output_arg_num => 0, } assert_response :success - assert_template 'index' + assert_template 'draw' assert_equal 1, assigns(:project).id assert_equal 'determinize', assigns(:bench).name @@ -99,4 +99,20 @@ assert_not_nil assigns(:input_set_num) end + def test_draw_bad_revision_format + post :draw, { + :bench_id => 1, + :revision => { :range => "-42---10" } + } + assert_response :redirect + assert_redirected_to :action => 'index' + + assert_equal 1, assigns(:project).id + assert_equal 'determinize', assigns(:bench).name + assert(flash.has_key?(:error)) + assert_not_nil assigns(:output_arg_num) + assert_not_nil assigns(:inputs) + assert_not_nil assigns(:input_set_num) + end + end
19 years, 1 month
1
0
0
0
[ranch] 42: Rename index to draw.
by Nicolas Despr�s
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog from Nicolas Despr�s <nicolas.despres(a)gmail.com> Rename index to draw. * web/ranch/app/controllers/graph_form_controller.rb: The index request use the draw template. * web/ranch/app/views/graph_form/draw.rhtml: Rename to ... * web/ranch/app/views/graph_form/index.rhtml: ...that. graph_form_controller.rb | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: web/ranch/app/controllers/graph_form_controller.rb --- web/ranch/app/controllers/graph_form_controller.rb (revision 41) +++ web/ranch/app/controllers/graph_form_controller.rb (working copy) @@ -19,6 +19,7 @@ @revision[:stop] = @project.head_revision @revision[:start] = @revision[:stop] - DEFAULT_REVISION_RANGE @revision[:start] = 1 if @revision[:start] < 1 + render :action => 'draw' end def draw @@ -40,7 +41,6 @@ @revision = get_revision_range(params[:revision][:range]) if flash[:error].nil? @draw_on = true - render :action => 'index' else redirect_to(:action => 'index', :bench_id => @bench.id) end
19 years, 1 month
1
0
0
0
[ranch] 41: Check revision input format.
by Nicolas Despr�s
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog from Nicolas Despr�s <nicolas.despres(a)gmail.com> Check revision input format. * web/ranch/app/controllers/graph_form_controller.rb: Extract the start revision and the stop revision from the input field using a regular expression. * web/ranch/app/views/graph_form/index.rhtml: Only one text field is needed now (the new format is start_rev-stop_rev). controllers/graph_form_controller.rb | 31 ++++++++++++++++++++++--------- views/graph_form/index.rhtml | 10 ++++------ 2 files changed, 26 insertions(+), 15 deletions(-) Index: web/ranch/app/controllers/graph_form_controller.rb --- web/ranch/app/controllers/graph_form_controller.rb (revision 40) +++ web/ranch/app/controllers/graph_form_controller.rb (working copy) @@ -37,20 +37,33 @@ "ORDER BY outputs.arg_num " @output_arg_nb = @output_arg_nb.size end - @revision = params[:revision] - head_rev = @project.head_revision - @revision[:stop] = @revision[:stop].to_i - @revision[:stop] = head_rev if @revision[:stop] > head_rev - @revision[:start] = @revision[:start].to_i - @revision[:start] = 1 if @revision[:start] < 1 - if @revision[:start] < @revision[:stop] + @revision = get_revision_range(params[:revision][:range]) + if flash[:error].nil? @draw_on = true render :action => 'index' else - flash[:error] = 'The start revision must be lesser than ' + - 'the stop revision.' redirect_to(:action => 'index', :bench_id => @bench.id) end end + protected + + def get_revision_range(revision, head_rev=(a)project.head_revision) + result = {} + if revision =~ /^(-?\d+)-(-?\d+)$/ + result[:start] = $1 + result[:stop] = $2 + result[:stop] = result[:stop].to_i + result[:stop] = head_rev if result[:stop] > head_rev + result[:start] = result[:start].to_i + result[:start] = 1 if result[:start] < 1 + if result[:start] > result[:stop] + flash[:error] = 'Start revision greater than stop revision.' + end + else + flash[:error] = "Bad revision range format." + end + result + end + end Index: web/ranch/app/views/graph_form/index.rhtml --- web/ranch/app/views/graph_form/index.rhtml (revision 40) +++ web/ranch/app/views/graph_form/index.rhtml (working copy) @@ -12,12 +12,10 @@ <td> <table> <tr> - <td>from</td> - <td><%= text_field "revision", "start", "size" => 8, - "value" => @revision[:start] %></td> - <td>to</td> - <td><%= text_field "revision", "stop", "size" => 8, - "value" => @revision[:stop] %></td> + <td> + <%= text_field "revision", "range", "size" => 16, + "value" => "#{@revision[:start]}-#{@revision[:stop]}" %> + </td> </tr> </table> </td>
19 years, 1 month
1
0
0
0
[ranch] 40: Move the revision field from benches to outputs.
by Nicolas Despr�s
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog from Nicolas Despr�s <nicolas.despres(a)gmail.com> Move the revision field from benches to outputs. * web/ranch/test/fixtures/outputs.yml: The bench_id is now always equal to one. * web/ranch/test/fixtures/benches.yml: No longer iteration over revision. * web/ranch/app/models/bench.rb: Overload input request to force to order by set_num and arg_num. * web/ranch/app/controllers/graph_form_controller.rb, * web/ranch/app/controllers/graph_controller.rb: Only takes the bench id as parameter. Query only on the outputs table. * web/ranch/app/views/layouts/_left_margin.rhtml: Only gives the bench id as parameter. * web/ranch/test/functional/graph_form_controller_test.rb, * web/ranch/app/helpers/graph_helper.rb, * web/ranch/app/views/graph_form/index.rhtml: Update to the new parameter signature. app/controllers/graph_controller.rb | 23 +++++++---------- app/controllers/graph_form_controller.rb | 34 ++++++-------------------- app/helpers/graph_helper.rb | 6 +--- app/models/bench.rb | 6 ++++ app/views/graph_form/index.rhtml | 11 +++----- app/views/layouts/_left_margin.rhtml | 3 -- test/fixtures/benches.yml | 4 --- test/fixtures/outputs.yml | 4 ++- test/functional/graph_form_controller_test.rb | 24 +++++++----------- 9 files changed, 47 insertions(+), 68 deletions(-) Index: web/ranch/test/functional/graph_form_controller_test.rb --- web/ranch/test/functional/graph_form_controller_test.rb (revision 39) +++ web/ranch/test/functional/graph_form_controller_test.rb (working copy) @@ -14,12 +14,12 @@ end def test_index - get :index, { :project_id => 1, :bench_name => 'determinize' } + get :index, { :bench_id => 1 } assert_response :success assert_template 'index' assert_not_nil assigns(:project) - assert_not_nil assigns(:bench_name) + assert_not_nil assigns(:bench) assert_not_nil assigns(:output_arg_num) assert_not_nil assigns(:inputs) assert !assigns(:draw_on) @@ -30,15 +30,14 @@ def test_draw_regular_revision_range post :draw, { - :project_id => 1, - :bench_name => 'determinize', + :bench_id => 1, :revision => { :start => 2, :stop => 8 } } assert_response :success assert_template 'index' assert_not_nil assigns(:project) - assert_not_nil assigns(:bench_name) + assert_not_nil assigns(:bench) assert_not_nil assigns(:output_arg_num) assert_not_nil assigns(:inputs) assert_not_nil assigns(:input_set_num) @@ -50,15 +49,14 @@ def test_draw_bad_revision_range post :draw, { - :project_id => 1, - :bench_name => 'determinize', + :bench_id => 1, :revision => { :start => -42, :stop => 500 } } assert_response :success assert_template 'index' assert_not_nil assigns(:project) - assert_not_nil assigns(:bench_name) + assert_not_nil assigns(:bench) assert_not_nil assigns(:output_arg_num) assert_not_nil assigns(:inputs) assert_not_nil assigns(:input_set_num) @@ -70,15 +68,14 @@ def test_draw_start_sup_stop post :draw, { - :project_id => 1, - :bench_name => 'determinize', + :bench_id => 1, :revision => { :start => 42, :stop => 10 } } assert_response :redirect assert_redirected_to :action => 'index' assert_equal 1, assigns(:project).id - assert_equal 'determinize', assigns(:bench_name) + assert_equal 'determinize', assigns(:bench).name assert(flash.has_key?(:error)) assert_not_nil assigns(:output_arg_num) assert_not_nil assigns(:inputs) @@ -87,8 +84,7 @@ def test_draw_output_arg_num post :draw, { - :project_id => 1, - :bench_name => 'determinize', + :bench_id => 1, :revision => { :start => 1, :stop => 10 }, :output_arg_num => 0, } @@ -96,7 +92,7 @@ assert_template 'index' assert_equal 1, assigns(:project).id - assert_equal 'determinize', assigns(:bench_name) + assert_equal 'determinize', assigns(:bench).name assert_equal 0, assigns(:output_arg_num) assert_equal 3, assigns(:output_arg_nb) assert_not_nil assigns(:inputs) Index: web/ranch/test/fixtures/outputs.yml --- web/ranch/test/fixtures/outputs.yml (revision 39) +++ web/ranch/test/fixtures/outputs.yml (working copy) @@ -1,5 +1,7 @@ <% id = 0 %> +# Ouputs for the determinize (id = 1) bench. + <% outputs = { 'utime' => { :unit => 'sec', :val => 20, :inc => -1 }, 'memory' => { :unit => 'KB', :val => 50000, :inc => -1000 }, @@ -18,7 +20,7 @@ name: <%= name %> unit: <%= desc[:unit].inspect %> value: <%= desc[:val] += desc[:inc] + set_num * 10%> - bench_id: <%= rev %> + bench_id: <%= 1 %> arg_num: <%= arg_num += 1 %> set_num: <%= set_num %> system_id: 0 Index: web/ranch/test/fixtures/benches.yml --- web/ranch/test/fixtures/benches.yml (revision 39) +++ web/ranch/test/fixtures/benches.yml (working copy) @@ -1,11 +1,9 @@ <% id = 0 %> -<% (1..10).each do |rev| %> -<%= "determinize_r#{rev}:" %> +determinize: id: <%= id += 1 %> project_id: 1 name: determinize -<% end %> quotient: id: <%= id += 1 %> Index: web/ranch/app/helpers/graph_helper.rb --- web/ranch/app/helpers/graph_helper.rb (revision 39) +++ web/ranch/app/helpers/graph_helper.rb (working copy) @@ -1,7 +1,6 @@ module GraphHelper - def graph_reg_tag(project_id, - bench_name, + def graph_reg_tag(bench_id, rev_start, rev_stop, arg_num, @@ -10,8 +9,7 @@ url = { :controller => 'graph', :action => 'regression', - :project_id => project_id, - :bench_name => bench_name, + :bench_id => bench_id, :rev_start => rev_start, :rev_stop => rev_stop, :arg_num => arg_num, Index: web/ranch/app/models/bench.rb --- web/ranch/app/models/bench.rb (revision 39) +++ web/ranch/app/models/bench.rb (working copy) @@ -6,4 +6,10 @@ validates_presence_of :name validates_length_of :name, :maximum => 255 + def input + Input.find(:all, + :conditions => [ "bench_id = ?", id ], + :order => "set_num, arg_num") + end + end Index: web/ranch/app/controllers/graph_controller.rb --- web/ranch/app/controllers/graph_controller.rb (revision 39) +++ web/ranch/app/controllers/graph_controller.rb (working copy) @@ -3,20 +3,17 @@ load 'grapher.rb' def regression - @project = Project.find params[:project_id] - @bench_name = params[:bench_name] + @bench = Bench.find_by_id params[:bench_id] + @project = @bench.project - 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' " + - "AND outputs.bench_id = benches.id " + - "AND outputs.arg_num = #{params[:arg_num]} " + - "AND outputs.set_num = #{params[:input_set_num]} " + - "AND #{params[:rev_start]} <= benches.revision " + - "AND benches.revision <= #{params[:rev_stop]} " + - "ORDER BY benches.revision" + results = Bench.find_by_sql "SELECT value, name, unit, revision " + + "FROM outputs " + + "WHERE bench_id = #{(a)bench.id} " + + "AND arg_num = #{params[:arg_num]} " + + "AND set_num = #{params[:input_set_num]} " + + "AND #{params[:rev_start]} <= revision " + + "AND revision <= #{params[:rev_stop]} " + + "ORDER BY revision" data = results.collect { |v| v.value.to_f } labels = results.collect { |v| "r#{v.revision}" } Index: web/ranch/app/controllers/graph_form_controller.rb --- web/ranch/app/controllers/graph_form_controller.rb (revision 39) +++ web/ranch/app/controllers/graph_form_controller.rb (working copy) @@ -9,9 +9,9 @@ DEFAULT_REVISION_RANGE = 100 def index - @bench_name = params[:bench_name] - @project = Project.find params[:project_id] - select_inputs + @bench = Bench.find_by_id params[:bench_id] + @project = @bench.project + @inputs = @bench.input @intput_set_num = 0 @output_arg_num = 0 @draw_on = false @@ -22,18 +22,16 @@ end def draw - @bench_name = params[:bench_name] - @project = Project.find params[:project_id] + @bench = Bench.find_by_id params[:bench_id] + @project = @bench.project @draw_on = true - select_inputs + @inputs = @bench.input @input_set_num = params[:input_set_num].to_i @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 " + + "FROM outputs " + + "WHERE outputs.bench_id = #{(a)bench.id} " + "AND outputs.set_num = #@input_set_num " + "GROUP BY outputs.arg_num " + "ORDER BY outputs.arg_num " @@ -51,22 +49,8 @@ else flash[:error] = 'The start revision must be lesser than ' + 'the stop revision.' - redirect_to(:action => 'index', - :project_id => @project.id, - :bench_name => @bench_name) + redirect_to(:action => 'index', :bench_id => @bench.id) end end - protected - - def select_inputs - @inputs = Input.find_by_sql "SELECT inputs.name, inputs.unit, " + - "inputs.value, inputs.arg_num, inputs.set_num " + - "FROM inputs, benches " + - "WHERE benches.id = #{(a)project.id} " + - "AND benches.name = '#@bench_name' " + - "AND benches.id = inputs.bench_id " + - "ORDER BY inputs.set_num, inputs.arg_num" - end - end Index: web/ranch/app/views/layouts/_left_margin.rhtml --- web/ranch/app/views/layouts/_left_margin.rhtml (revision 39) +++ web/ranch/app/views/layouts/_left_margin.rhtml (working copy) @@ -19,8 +19,7 @@ <td> <%= link_to bench.name, :controller => "graph_form", :action => "index", - :project_id => project.id, - :bench_name => bench.name %> + :bench_id => bench.id %> </td> </tr> <% end %> Index: web/ranch/app/views/graph_form/index.rhtml --- web/ranch/app/views/graph_form/index.rhtml (revision 39) +++ web/ranch/app/views/graph_form/index.rhtml (working copy) @@ -1,8 +1,7 @@ <!-- -*- html -*- --> -<%= content_tag "h3", "#{(a)project.name}: #{@bench_name}" %> +<%= content_tag "h3", "#{(a)project.name}: #{(a)bench.name}" %> <%= start_form_tag :action => "draw", - :project_id => @project.id, - :bench_name => @bench_name %> + :bench_id => @bench.id %> <table cellspacing=10> @@ -60,7 +59,7 @@ <td> <table> <tr> - <td><%= outputs_tag "output_arg_num", @bench_name, @output_arg_num %></td> + <td><%= outputs_tag "output_arg_num", @bench.name, @output_arg_num %></td> </tr> </td> </table> @@ -82,13 +81,13 @@ <% if @output_arg_num.zero? %> <% 1.upto(@output_arg_nb) do |i| %> <p> - <%= graph_reg_tag @project.id, @bench_name, + <%= graph_reg_tag @bench.id, @revision[:start], @revision[:stop], i, @input_set_num %> </p> <% end %> <% else %> - <%= graph_reg_tag @project.id, @bench_name, + <%= graph_reg_tag @bench.id, @revision[:start], @revision[:stop], @output_arg_num, @input_set_num %> <% end %>
19 years, 1 month
1
0
0
0
Re: [ranch] 37: Factorize project request in a filter.
by Akim Demaille
>>> "Nicolas" == Nicolas Desprès <nicolas.despres(a)lrde.epita.fr> writes: > Factorize project request in a filter. Factor, bon sang.
19 years, 1 month
2
1
0
0
[ranch] 39: Move the revision field from benches to outputs.
by Nicolas Despr�s
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog from Nicolas Desprès <nicolas.despres(a)lrde.epita.fr> Move the revision field from benches to outputs. * web/ranch/db/schema.rb: Move the revision field from the benches table to the outputs table. * web/ranch/test/unit/bench_test.rb, * web/ranch/test/unit/output_test.rb, * web/ranch/test/fixtures/outputs.yml, * web/ranch/test/fixtures/benches.yml, * web/ranch/app/models/bench.rb, * web/ranch/app/models/output.rb: Update. app/models/bench.rb | 11 +---------- app/models/output.rb | 6 +++++- db/schema.rb | 9 ++------- test/fixtures/benches.yml | 4 ---- test/fixtures/outputs.yml | 1 + test/unit/bench_test.rb | 5 ----- test/unit/output_test.rb | 5 +++++ 7 files changed, 14 insertions(+), 27 deletions(-) Index: web/ranch/test/unit/bench_test.rb --- web/ranch/test/unit/bench_test.rb (revision 38) +++ web/ranch/test/unit/bench_test.rb (working copy) @@ -12,11 +12,6 @@ assert !bench.save end - def test_save_presence_of_revision - bench = Bench.new(:name => 'foo', :revision => 0) - assert !bench.save - end - def test_save_maximum_lenght_of_name bench = Bench.new(:name => '' * 256) assert !bench.save Index: web/ranch/test/unit/output_test.rb --- web/ranch/test/unit/output_test.rb (revision 38) +++ web/ranch/test/unit/output_test.rb (working copy) @@ -17,4 +17,9 @@ assert !output.save end + def test_save_presence_of_revision + output = Output.new(:name => 'foo', :revision => 0) + assert !output.save + end + end Index: web/ranch/test/fixtures/outputs.yml --- web/ranch/test/fixtures/outputs.yml (revision 38) +++ web/ranch/test/fixtures/outputs.yml (working copy) @@ -22,6 +22,7 @@ arg_num: <%= arg_num += 1 %> set_num: <%= set_num %> system_id: 0 + revision: <%= rev %> <% end %> <% set_num += 1 Index: web/ranch/test/fixtures/benches.yml --- web/ranch/test/fixtures/benches.yml (revision 38) +++ web/ranch/test/fixtures/benches.yml (working copy) @@ -5,24 +5,20 @@ id: <%= id += 1 %> project_id: 1 name: determinize - revision: <%= rev %> <% end %> quotient: id: <%= id += 1 %> project_id: 1 name: quotient - revision: 1 open: id: <%= id += 1 %> project_id: 2 name: open - revision: 1 close: id: <%= id += 1 %> project_id: 2 name: close - revision: 1 Index: web/ranch/app/models/bench.rb --- web/ranch/app/models/bench.rb (revision 38) +++ web/ranch/app/models/bench.rb (working copy) @@ -3,16 +3,7 @@ belongs_to :project has_many :output - validates_presence_of :name, :revision - validates_numericality_of :revision, :only_integer => true + validates_presence_of :name validates_length_of :name, :maximum => 255 - protected - - def validate - unless revision.to_i > 0 - errors.add("revision", "is not positive") - end - end - end Index: web/ranch/app/models/output.rb --- web/ranch/app/models/output.rb (revision 38) +++ web/ranch/app/models/output.rb (working copy) @@ -3,9 +3,10 @@ belongs_to :bench belongs_to :system - validates_presence_of :name, :value, :arg_num, :set_num + validates_presence_of :name, :value, :arg_num, :set_num, :revision validates_numericality_of :value validates_numericality_of :arg_num, :set_num, :only_integer => true + validates_numericality_of :revision, :only_integer => true validates_length_of :name, :unit, :maximum => 128 protected @@ -13,6 +14,9 @@ def validate errors.add("arg_num", "is not positive") unless arg_num.to_i >= 0 errors.add("set_num", "is not positive") unless set_num.to_i >= 0 + unless revision.to_i > 0 + errors.add("revision", "is not positive") + end end end Index: web/ranch/db/schema.rb --- web/ranch/db/schema.rb (revision 38) +++ web/ranch/db/schema.rb (working copy) @@ -5,9 +5,8 @@ ActiveRecord::Schema.define() do create_table "benches", :force => true do |t| - t.column "name", :string, :limit => 255, :default => "noname", :null => false + t.column "name", :string, :default => "noname", :null => false t.column "project_id", :integer, :default => 1, :null => false - t.column "revision", :integer, :default => 1, :null => false end add_index "benches", ["project_id"], :name => "project_id" @@ -29,6 +28,7 @@ t.column "arg_num", :integer, :limit => 8, :default => 1, :null => false t.column "set_num", :integer, :default => 0, :null => false t.column "system_id", :integer, :default => 1, :null => false + t.column "revision", :integer, :default => 1, :null => false end add_index "outputs", ["bench_id"], :name => "bench_id" @@ -40,11 +40,6 @@ create_table "systems", :force => true do |t| t.column "hostname", :string, :limit => 128, :default => "localhost", :null => false - t.column "info", :text, :default => "", :null => false - end - - create_table "systems", :force => true do |t| - t.column "hostname", :string, :limit => 128, :default => "localhost", :null => false t.column "kernel_name", :string, :limit => 64 t.column "kernel_version", :string, :limit => 64 t.column "host_type", :string, :limit => 64
19 years, 1 month
1
0
0
0
[ranch] 38: Clean condition usage.
by Nicolas Despr�s
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog from Nicolas Desprès <nicolas.despres(a)lrde.epita.fr> Clean condition usage. * web/ranch/app/models/project.rb: Use Rails syntax instead of ugly plain string. project.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: web/ranch/app/models/project.rb --- web/ranch/app/models/project.rb (revision 37) +++ web/ranch/app/models/project.rb (working copy) @@ -8,7 +8,7 @@ validates_length_of :name, :maximum => 255 def bench_ordered_by_name - Bench.find :all, :conditions => "project_id = #{id}", :order => "name" + Bench.find :all, :conditions => [ "project_id = ?", id ], :order => "name" end protected
19 years, 1 month
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
9
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
Results per page:
10
25
50
100
200