diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index 4c05d78e..2bd20d4a 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -114,8 +114,8 @@ class StatsController < ApplicationController @actions_completion_time_array = cut_off_array_with_sum(@actions_completed_per_week_array, @count) @max_actions = @actions_completion_time_array.max - # get percentage done cummulative - @cumm_percent_done = convert_to_cummulative_array(@actions_completion_time_array, @actions_completion_time.count) + # get percentage done cumulative + @cum_percent_done = convert_to_cumulative_array(@actions_completion_time_array, @actions_completion_time.count) render :layout => false end @@ -134,8 +134,8 @@ class StatsController < ApplicationController @actions_running_time_array = cut_off_array_with_sum(@actions_running_per_week_array, @count) @max_actions = @actions_running_time_array.max - # get percentage done cummulative - @cumm_percent_done = convert_to_cummulative_array(@actions_running_time_array, @actions_running_time.count ) + # get percentage done cumulative + @cum_percent_done = convert_to_cumulative_array(@actions_running_time_array, @actions_running_time.count ) render :layout => false end @@ -163,8 +163,8 @@ class StatsController < ApplicationController @actions_running_time_array = cut_off_array_with_sum(@actions_running_per_week_array, @count) @max_actions = @actions_running_time_array.max - # get percentage done cummulative - @cumm_percent_done = convert_to_cummulative_array(@actions_running_time_array, @actions_running_time.count ) + # get percentage done cumulative + @cum_percent_done = convert_to_cumulative_array(@actions_running_time_array, @actions_running_time.count ) render :layout => false end @@ -669,10 +669,10 @@ class StatsController < ApplicationController return Array.new(cut_off){|i| array[i]||0} end - def convert_to_cummulative_array(array, max) + def convert_to_cumulative_array(array, max) # calculate fractions a = Array.new(array.size){|i| array[i]*100.0/max} - # make cummulative + # make cumulative 1.upto(array.size-1){ |i| a[i] += a[i-1] } return a end diff --git a/app/views/stats/actions_completion_time_data.html.erb b/app/views/stats/actions_completion_time_data.html.erb index 27008ffe..c70912f0 100755 --- a/app/views/stats/actions_completion_time_data.html.erb +++ b/app/views/stats/actions_completion_time_data.html.erb @@ -11,7 +11,7 @@ time_labels[@count] = "> #{@count}" &filled_bar=50,0x9933CC,0x8010A0& &values=<%= @actions_completion_time_array.join(",")%>& &line_2=2,0xFF0000& -&values_2=<%= @cumm_percent_done.join(",")%>& +&values_2=<%= @cum_percent_done.join(",")%>& &x_labels=<%= time_labels.join(",")%>& &y_min=0& <% diff --git a/app/views/stats/actions_running_time_data.html.erb b/app/views/stats/actions_running_time_data.html.erb index 37c7612d..6126b31a 100755 --- a/app/views/stats/actions_running_time_data.html.erb +++ b/app/views/stats/actions_running_time_data.html.erb @@ -15,7 +15,7 @@ time_labels[@count] = "> #{@count}" &values=<%= @actions_running_time_array.join(",") -%>& &links=<%= url_labels.join(",") %>& &line_2=2,0xFF0000& -&values_2=<%= @cumm_percent_done.join(",") %>& +&values_2=<%= @cum_percent_done.join(",") %>& &x_labels=<%= time_labels.join(",") %> & &y_min=0& <% diff --git a/app/views/stats/actions_visible_running_time_data.html.erb b/app/views/stats/actions_visible_running_time_data.html.erb index 92ff5d5f..c68969ec 100755 --- a/app/views/stats/actions_visible_running_time_data.html.erb +++ b/app/views/stats/actions_visible_running_time_data.html.erb @@ -15,7 +15,7 @@ time_labels[@count] = "> #{@count}" &values=<%= @actions_running_time_array.join(",") -%>& &links=<%= url_labels.join(",") %>& &line_2=2,0xFF0000& -&values_2=<%= @cumm_percent_done.join(",") -%>& +&values_2=<%= @cum_percent_done.join(",") -%>& &x_labels=<%= time_labels.join(",")%>& &y_min=0& <% diff --git a/test/functional/stats_controller_test.rb b/test/functional/stats_controller_test.rb index 081d1f0b..60b71872 100644 --- a/test/functional/stats_controller_test.rb +++ b/test/functional/stats_controller_test.rb @@ -188,7 +188,7 @@ class StatsControllerTest < ActionController::TestCase assert_equal 3, assigns['max_actions'], "3 completed within one week" assert_equal 11, assigns['actions_completion_time_array'].size, "there should be 10 weeks of data + 1 for the rest" assert_equal 1, assigns['actions_completion_time_array'][10], "there is one completed todo after the 10 weeks cut_off" - assert_equal 100.0, assigns['cumm_percent_done'][10], "cummulative percentage should add up to 100%" + assert_equal 100.0, assigns['cum_percent_done'][10], "cumulative percentage should add up to 100%" end def test_actions_running_time_data @@ -207,7 +207,7 @@ class StatsControllerTest < ActionController::TestCase assert_equal 2, assigns['max_actions'], "2 actions running long together" assert_equal 18, assigns['actions_running_time_array'].size, "there should be 17 weeks ( < cut_off) of data + 1 for the rest" assert_equal 1, assigns['actions_running_time_array'][17], "there is one running todos in week 17 and zero after 17 weeks ( < cut off; ) " - assert_equal 100.0, assigns['cumm_percent_done'][17], "cummulative percentage should add up to 100%" + assert_equal 100.0, assigns['cum_percent_done'][17], "cumulative percentage should add up to 100%" end def test_actions_open_per_week_data @@ -247,7 +247,7 @@ class StatsControllerTest < ActionController::TestCase assert_equal 1, assigns['actions_running_time_array'][0], "there is one running todos and one deferred todo created in week 1" assert_equal 18, assigns['actions_running_time_array'].size, "there should be 17 weeks ( < cut_off) of data + 1 for the rest" assert_equal 1, assigns['actions_running_time_array'][17], "there is one running todos in week 17 and zero after 17 weeks ( < cut off; ) " - assert_equal 100.0, assigns['cumm_percent_done'][17], "cummulative percentage should add up to 100%" + assert_equal 100.0, assigns['cum_percent_done'][17], "cumulative percentage should add up to 100%" end def test_context_total_actions_data