<% @pagetitle = "Rebuild time for Project #{@project}" %>
<% project_bread_crumb( "Rebuild Time of #{@repository}/#{@arch}" ) -%>

<%= render :partial => 'tabs' %>

<h3>Rebuildtime: <%= distance_of_time_in_words(Time.now, Time.now - @rebuildtime) %> (<%= format_seconds(@rebuildtime) %>)</h3>
<p><img class="rebuildgraph" src="<%= url_for(:action => :rebuild_time_png, :key => @pngkey) %>" alt="Rebuild graph" /></p>

<p>Note that the above graph is based on real dependencies and real build times, but it is only a simulation of what
may happen when there is no other trouble and with a fixed set of build jobs associated to the project (usually not the
case). To see what happens with less or more build hosts, play with these numbers:</p>

<%= form_tag(project_rebuild_time_path(project: @project.name), method: "GET") do -%>
   <%= hidden_field_tag(:arch, @arch) %>
   <%= hidden_field_tag(:repository, @repository) %>
   <p>Jobs: <%= select_tag("hosts", options_for_select((2..100).to_a, @hosts)) %>
   <%= submit_tag "Check" %>
   </p>

<% end %>

<h3>Longest Paths</h3>

<table class='grid_16 alpha omega'>
<% p1 = @longestpaths[0].reverse
   p2 = @longestpaths[1].reverse
   p3 = @longestpaths[2].reverse 
%>
 
<tbody>
<% while p1.size + p2.size + p3.size > 0 do %>
<tr>
<td><%= rebuild_time_col(p1.shift) %></td>
<td><%= rebuild_time_col(p2.shift) %></td>
<td><%= rebuild_time_col(p3.shift) %></td>
</tr>
<% end %>
</tbody>
</table>
