summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-10-01 18:08:54 -0500
committerDan McGee <dan@archlinux.org>2010-10-01 18:08:54 -0500
commited49122429276ea1ee9b5b07507e9a3ba3f71cf2 (patch)
tree6da313f8fe4238dc5bd981516bb1de8ad8001a49
parent77f65bdc0c9f5524ca68be511af4280f08fbcc13 (diff)
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 <dan@archlinux.org>
-rw-r--r--mirrors/utils.py6
1 files changed, 5 insertions, 1 deletions
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