From ed49122429276ea1ee9b5b07507e9a3ba3f71cf2 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 1 Oct 2010 18:08:54 -0500 Subject: Fix an off by one error in math for check interval Because we are averaging the interval and not the value, we need to subtract one from the total we are dividing by. Whoops. Signed-off-by: Dan McGee --- mirrors/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mirrors/utils.py b/mirrors/utils.py index a26b19ce..e6d6c1dd 100644 --- a/mirrors/utils.py +++ b/mirrors/utils.py @@ -40,7 +40,11 @@ def get_mirror_statuses(cutoff=default_cutoff): check_info = MirrorLog.objects.filter( check_time__gte=cutoff_time).aggregate( mn=Min('check_time'), mx=Max('check_time')) - check_frequency = (check_info['mx'] - check_info['mn']) / num_checks + if num_checks > 1: + check_frequency = (check_info['mx'] - check_info['mn']) \ + / (num_checks - 1) + else: + check_frequency = None; else: last_check = None num_checks = 0 -- cgit v1.2.3-55-g3dc8