From bc7bf459dba2e77ac929187b1c87fc2998bbbbd6 Mon Sep 17 00:00:00 2001 From: Reinier Balt Date: Fri, 20 Jan 2012 23:50:27 +0100 Subject: [PATCH] fix small regressions --- app/controllers/stats_controller.rb | 4 ++-- app/views/stats/actions_completion_time_data.html.erb | 4 ++-- app/views/stats/actions_running_time_data.html.erb | 2 +- app/views/stats/actions_visible_running_time_data.html.erb | 4 ++-- test/functional/stats_controller_test.rb | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index fc4f1394..ff9ecaf2 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -682,7 +682,7 @@ class StatsController < ApplicationController end def interpolate_avg(set, percent) - return (set[0]*percent + set[1] + set[2]) / 3.0 + return (set[0]*(1/percent) + set[1] + set[2]) / 3.0 end def correct_last_two_months(month_data, count) @@ -698,4 +698,4 @@ class StatsController < ApplicationController return avg_done, avg_created end -end \ No newline at end of file +end diff --git a/app/views/stats/actions_completion_time_data.html.erb b/app/views/stats/actions_completion_time_data.html.erb index b38a464a..d1830419 100755 --- a/app/views/stats/actions_completion_time_data.html.erb +++ b/app/views/stats/actions_completion_time_data.html.erb @@ -1,7 +1,7 @@ <%- time_labels = Array.new(@count){ |i| "#{i}-#{i+1}" } time_labels[0] = "within 1" -time_labels[@count] = "#{@count}" +time_labels[@count] = "> #{@count}" -%> &title=<%= t('stats.action_completion_time_title') %>,{font-size:16},& &y_legend=<%= t('stats.legend.actions') %>,10,0x8010A0& @@ -23,4 +23,4 @@ time_labels[@count] = "#{@count}" &y2_lines=2& &y2_min=0& &y2_max=100& -&x_label_style=9,,2,1& \ No newline at end of file +&x_label_style=9,,2,1& diff --git a/app/views/stats/actions_running_time_data.html.erb b/app/views/stats/actions_running_time_data.html.erb index 6578a1cf..37c7612d 100755 --- a/app/views/stats/actions_running_time_data.html.erb +++ b/app/views/stats/actions_running_time_data.html.erb @@ -4,7 +4,7 @@ url_labels[@count]=url_for(:controller => 'stats', :action => 'show_selected_act time_labels = Array.new(@count){ |i| "#{i}-#{i+1}" } time_labels[0] = "< 1" -time_labels[@count] = "#{@count}" +time_labels[@count] = "> #{@count}" -%> &title=<%= t('stats.running_time_all') %>,{font-size:16},& &y_legend=<%= t('stats.running_time_all_legend.actions') %>,10,0x736AFF& 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 cd913eb4..92ff5d5f 100755 --- a/app/views/stats/actions_visible_running_time_data.html.erb +++ b/app/views/stats/actions_visible_running_time_data.html.erb @@ -4,7 +4,7 @@ url_labels[@count]=url_for(:controller => 'stats', :action => 'show_selected_act time_labels = Array.new(@count){ |i| "#{i}-#{i+1}" } time_labels[0] = "< 1" -time_labels[@count] = "#{@count}" +time_labels[@count] = "> #{@count}" -%> &title=<%= t('stats.current_running_time_of_incomplete_visible_actions') %>,{font-size:16},& &y_legend=<%= t('stats.running_time_legend.actions') %>,10,0x736AFF& @@ -27,4 +27,4 @@ time_labels[@count] = "#{@count}" &show_y2=true& &y2_lines=2& &y2_min=0& -&y2_max=100& \ No newline at end of file +&y2_max=100& diff --git a/test/functional/stats_controller_test.rb b/test/functional/stats_controller_test.rb index d7844cb1..5aad0c4c 100755 --- a/test/functional/stats_controller_test.rb +++ b/test/functional/stats_controller_test.rb @@ -137,7 +137,7 @@ class StatsControllerTest < ActionController::TestCase # And the current month should be interpolated fraction = Time.zone.now.day.to_f / Time.zone.now.end_of_month.day.to_f - assert_equal (2*fraction+2)/3.0, assigns['interpolated_actions_created_this_month'], "two this month and one in the last two months" + assert_equal (2*(1/fraction)+2)/3.0, assigns['interpolated_actions_created_this_month'], "two this month and one in the last two months" assert_equal 2/3.0, assigns['interpolated_actions_done_this_month'], "none this month and one two the last two months" # And totals should be calculated