tracks/app/views/stats/_projects.html.erb
Katrina Owen 6385059de8 Increment list counter in project view
This fixes a bug where if you have fewer than 10 projects, your top 10
projects were listed as:

6 - n/a (n/a)
6 - n/a (n/a)
6 - n/a (n/a)
6 - n/a (n/a)

rather than

7 - n/a (n/a)
8 - n/a (n/a)
9 - n/a (n/a)
10 - n/a (n/a)
2013-03-02 00:11:31 -05:00

38 lines
1.3 KiB
Text
Executable file

<div class="stats_module">
<h3><%= t('stats.top10_projects') %></h3>
<% i=0
@projects_and_actions.each do |p|
i+=1 -%>
<%= i -%> - <%= link_to p.name, {:controller => "projects", :action => "show", :id => p.id}%> (<%=p.count %> <%= t('common.actions_midsentence', :count => p.count) %>) <br/>
<% end
if i < 10
(i+1).upto 10 do |j| -%>
<%= j -%> - <%=t('common.not_available_abbr')%> (<%=t('common.not_available_abbr')%>) <br/>
<% end
end
-%>
</div>
<div class="stats_module">
<h3><%= t('stats.top10_projects_30days') %></h3>
<% i=0
@projects_and_actions_last30days.each do |p|
i+=1 -%>
<%= i -%> - <%= link_to p.name, {:controller => "projects", :action => "show", :id => p.id} %> (<%=p.count %> <%= t('common.actions_midsentence', :count => p.count) %>) <br/>
<% end
if i < 10
(i+1).upto 10 do |j| -%>
<%= j -%> - <%=t('common.not_available_abbr')%> (<%=t('common.not_available_abbr')%>) <br/>
<% end
end
-%>
</div>
<div class="stats_module">
<h3><%= t('stats.top10_longrunning') %></h3>
<% i=0
@projects_and_runtime.each do |id, name, days|
i+=1 -%>
<%= i -%> - <%= link_to name, {:controller => "projects", :action => "show", :id => id} %> (<%=days %> <%= t('common.days_midsentence', :count => days) %>) <br/>
<% end -%>
</div>