Merge pull request #168 from kytrinyx/stats-actions

Encapsulate the stats for actions on the stats index page
This commit is contained in:
Reinier Balt 2013-03-02 13:58:32 -08:00
commit 1e3782ce67
7 changed files with 246 additions and 65 deletions

View file

@ -1,19 +1,17 @@
<p><%= t('stats.actions_avg_completion_time', :count => (@actions_avg_ttc*10).round/10.0) %>
<%= t('stats.actions_min_max_completion_days', :max => (@actions_max_ttc*10).round/10.0, :min => (@actions_min_ttc*10).round/10.0) %>
<%= t('stats.actions_min_completion_time', :time => @actions_min_ttc_sec) %></p>
<%= render :partial => 'time_to_complete', :locals => {:ttc => actions.ttc} -%>
<p><%= t('stats.actions_actions_avg_created_30days', :count => (@sum_actions_created_last30days*10.0/30.0).round/10.0 )%>
<%= t('stats.actions_avg_completed_30days', :count => (@sum_actions_done_last30days*10.0/30.0).round/10.0 )%>
<%= t('stats.actions_avg_created', :count => (@sum_actions_created_last12months*10.0/12.0).round/10.0 )%>
<%= t('stats.actions_avg_completed', :count => (@sum_actions_done_last12months*10.0/12.0).round/10.0 )%></p>
<p><%= t('stats.actions_actions_avg_created_30days', :count => (actions.created_last30days*10.0/30.0).round/10.0 )%>
<%= t('stats.actions_avg_completed_30days', :count => (actions.done_last30days*10.0/30.0).round/10.0 )%>
<%= t('stats.actions_avg_created', :count => (actions.created_last12months*10.0/12.0).round/10.0 )%>
<%= t('stats.actions_avg_completed', :count => (actions.done_last12months*10.0/12.0).round/10.0 )%></p>
<% @completion_charts.each do |chart| %><%=
<% actions.completion_charts.each do |chart| %><%=
render :partial => 'chart', :locals => {:chart => chart}
-%><% end %>
<br style="clear:both">
<% @timing_charts.each do |chart| %><%=
<% actions.timing_charts.each do |chart| %><%=
render :partial => 'chart', :locals => {:chart => chart}
-%><% end %>

View file

@ -0,0 +1,4 @@
<p><%= t('stats.actions_avg_completion_time', :count => ttc.avg) %>
<%= t('stats.actions_min_max_completion_days', :max => ttc.max, :min => ttc.min) %>
<%= t('stats.actions_min_completion_time', :time => ttc.min_sec) %></p>

View file

@ -6,7 +6,7 @@
<% unless current_user.todos.empty? -%>
<h2><%= t('stats.actions') %></h2>
<%= render :partial => 'actions' -%>
<%= render :partial => 'actions', :locals => {:actions => @actions} -%>
<h2><%= t('stats.contexts') %></h2>
<%= render :partial => 'contexts' -%>