Encapsulate action stats

This gets rid of a bunch of instance variables in the view/controller
layer.
This commit is contained in:
Katrina Owen 2013-03-02 10:48:08 -05:00
parent 6c3f447d8e
commit 0ebb98d49f
4 changed files with 130 additions and 65 deletions

View file

@ -1,19 +1,19 @@
<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>
<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>
<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

@ -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' -%>