diff --git a/tracks/app/controllers/stats_controller.rb b/tracks/app/controllers/stats_controller.rb index afea86c0..378cdf1c 100755 --- a/tracks/app/controllers/stats_controller.rb +++ b/tracks/app/controllers/stats_controller.rb @@ -93,6 +93,11 @@ class StatsController < ApplicationController @actions_created_last12months_hash[i+2])/3.0 } + # interpolate avg for this month. Assume 31 days in this month + days_passed_this_month = Time.new.day/1.0 + @interpolated_actions_created_this_month = @actions_created_last12months_hash[0]/days_passed_this_month*31.0 + @interpolated_actions_done_this_month = @actions_done_last12months_hash[0]/days_passed_this_month*31.0 + render :layout => false end diff --git a/tracks/app/views/stats/actions_completion_time_data.rhtml b/tracks/app/views/stats/actions_completion_time_data.rhtml index 68e440f3..a3b3c44b 100755 --- a/tracks/app/views/stats/actions_completion_time_data.rhtml +++ b/tracks/app/views/stats/actions_completion_time_data.rhtml @@ -6,32 +6,33 @@ &filled_bar=50,0x9933CC,0x8010A0& &values= <% @count = @max_days > @cut_off*7 ? @cut_off : @max_days/7 - 0.upto @count-1 do |i| -%> -<%= @actions_completion_time_hash[i] -%>, +@count = @count.to_i +0.upto @count-1 do |i| -%> + <%= @actions_completion_time_hash[i] -%>, <% end -%> <% - @sum=0 - @count.upto @max_days/7 do |i| - @sum += @actions_completion_time_hash[i] - end -%> +@sum=0 +@count.upto @max_days/7 do |i| + @sum += @actions_completion_time_hash[i] +end -%> <%=@sum%>& &line_2=2,0xFF0000& &values_2= <% total=0 - @count = @max_days > @cut_off*7 ? @cut_off : @max_days/7 - 0.upto @count-1 do |i| - total += @actions_completion_time_hash[i]*100.0/@sum_actions -%> -<%= total -%>, +@count = @max_days > @cut_off*7 ? @cut_off : @max_days/7 +0.upto @count-1 do |i| + total += @actions_completion_time_hash[i]*100.0/@sum_actions -%> + <%= total -%>, <% end -%> <%= total+@sum*100.0/@sum_actions%>& &x_labels=within 1, <% 1.upto @count-1 do |i| -%> -<%= i %>-<%= i+1 %>, + <%= i %>-<%= i+1 %>, <% end -%> > <%= @count %>& &y_min=0& <% # add one to @max for people who have no actions completed yet. - # OpenFlashChart cannot handle y_max=0 -%> +# OpenFlashChart cannot handle y_max=0 -%> &y_max=<%=1+@max_actions+@max_actions/10-%>& &show_y2=true& &y2_lines=2& diff --git a/tracks/app/views/stats/actions_done_last12months_data.rhtml b/tracks/app/views/stats/actions_done_last12months_data.rhtml index 4925c3d5..98ef2356 100755 --- a/tracks/app/views/stats/actions_done_last12months_data.rhtml +++ b/tracks/app/views/stats/actions_done_last12months_data.rhtml @@ -8,18 +8,16 @@ &line_4=2,0x00FF00, Avg created, 9& &line_5=2,0xAA0000, 3 Month Avg Completed, 9& &line_6=2,0x007700, 3 Month Avg Created, 9& -&values= -<% 0.upto 11 do |i| -%> -<%= @actions_done_last12months_hash[i]%>, -<% end -%><%= @actions_done_last12months_hash[12]%>& -&values_2= -<% 0.upto 11 do |i| -%> -<%= @actions_created_last12months_hash[i]%>, -<% end -%><%= @actions_created_last12months_hash[12]%>& +&line_7=1,0xAA0000& +&line_8=1,0x007700& +&values=<% 0.upto 11 do |i| -%><%= @actions_done_last12months_hash[i]%>,<% end -%><%= @actions_done_last12months_hash[12]%>& +&values_2=<% 0.upto 11 do |i| -%><%= @actions_created_last12months_hash[i]%>,<% end -%><%= @actions_created_last12months_hash[12]%>& &values_3=<%0.upto 11 do |i| -%><%=@sum_actions_done_last12months/12-%>,<%end-%><%=@sum_actions_done_last12months/12-%>& &values_4=<%0.upto 11 do |i| -%><%=@sum_actions_created_last12months/12-%>,<%end-%><%=@sum_actions_created_last12months/12-%>& &values_5=<%0.upto 11 do |i| -%><%=@actions_done_avg_last12months_hash[i]-%>,<%end-%><%=@actions_done_avg_last12months_hash[12]-%>& &values_6=<%0.upto 11 do |i| -%><%=@actions_created_avg_last12months_hash[i]-%>,<%end-%><%=@actions_created_avg_last12months_hash[12]-%>& +&values_7=<%=@interpolated_actions_created_this_month%>,<%=@actions_done_avg_last12months_hash[1]%>& +&values_8=<%=@interpolated_actions_done_this_month%>,<%=@actions_created_avg_last12months_hash[1]%>& &x_labels=<%0.upto 11 do |i| -%> <%= Date::MONTHNAMES[ (Time.now.mon - i -1 ) % 12 + 1 ] -%>, <% end -%> diff --git a/tracks/public/swf/open-flash-chart.swf b/tracks/public/swf/open-flash-chart.swf index 5a884344..51fc19b2 100755 Binary files a/tracks/public/swf/open-flash-chart.swf and b/tracks/public/swf/open-flash-chart.swf differ