mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-17 07:40:12 +01:00
fix small regressions
This commit is contained in:
parent
7af2211479
commit
bc7bf459db
5 changed files with 8 additions and 8 deletions
|
|
@ -682,7 +682,7 @@ class StatsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def interpolate_avg(set, percent)
|
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
|
end
|
||||||
|
|
||||||
def correct_last_two_months(month_data, count)
|
def correct_last_two_months(month_data, count)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<%-
|
<%-
|
||||||
time_labels = Array.new(@count){ |i| "#{i}-#{i+1}" }
|
time_labels = Array.new(@count){ |i| "#{i}-#{i+1}" }
|
||||||
time_labels[0] = "within 1"
|
time_labels[0] = "within 1"
|
||||||
time_labels[@count] = "#{@count}"
|
time_labels[@count] = "> #{@count}"
|
||||||
-%>
|
-%>
|
||||||
&title=<%= t('stats.action_completion_time_title') %>,{font-size:16},&
|
&title=<%= t('stats.action_completion_time_title') %>,{font-size:16},&
|
||||||
&y_legend=<%= t('stats.legend.actions') %>,10,0x8010A0&
|
&y_legend=<%= t('stats.legend.actions') %>,10,0x8010A0&
|
||||||
|
|
|
||||||
|
|
@ -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 = Array.new(@count){ |i| "#{i}-#{i+1}" }
|
||||||
time_labels[0] = "< 1"
|
time_labels[0] = "< 1"
|
||||||
time_labels[@count] = "#{@count}"
|
time_labels[@count] = "> #{@count}"
|
||||||
-%>
|
-%>
|
||||||
&title=<%= t('stats.running_time_all') %>,{font-size:16},&
|
&title=<%= t('stats.running_time_all') %>,{font-size:16},&
|
||||||
&y_legend=<%= t('stats.running_time_all_legend.actions') %>,10,0x736AFF&
|
&y_legend=<%= t('stats.running_time_all_legend.actions') %>,10,0x736AFF&
|
||||||
|
|
|
||||||
|
|
@ -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 = Array.new(@count){ |i| "#{i}-#{i+1}" }
|
||||||
time_labels[0] = "< 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},&
|
&title=<%= t('stats.current_running_time_of_incomplete_visible_actions') %>,{font-size:16},&
|
||||||
&y_legend=<%= t('stats.running_time_legend.actions') %>,10,0x736AFF&
|
&y_legend=<%= t('stats.running_time_legend.actions') %>,10,0x736AFF&
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
# And the current month should be interpolated
|
# And the current month should be interpolated
|
||||||
fraction = Time.zone.now.day.to_f / Time.zone.now.end_of_month.day.to_f
|
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"
|
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
|
# And totals should be calculated
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue