From 2a296af10d34c65e0f94d1a5b70c84ba31596ba4 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 21 Sep 2010 17:30:14 -0500 Subject: Add ordering, sorting, and a lot more info to mirror status page This should get this to the point where it is releasable to the general public for their use and pleasure. Still not sure on how often the check should be run, and we probably want to incorporate this mined data into some other things like the mirror list generator. Signed-off-by: Dan McGee --- mirrors/views.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'mirrors') diff --git a/mirrors/views.py b/mirrors/views.py index a31c1371..59d6337b 100644 --- a/mirrors/views.py +++ b/mirrors/views.py @@ -69,12 +69,16 @@ def status(request): last_check=Max('logs__check_time'), duration_avg=Avg('logs__duration'), duration_min=Min('logs__duration'), duration_max=Max('logs__duration'), duration_stddev=StdDev('logs__duration') - ).order_by('mirror__country', 'url') + ).order_by('-last_sync', '-duration_avg') # errors during check process go in another table error_logs = MirrorLog.objects.filter( is_success=False, check_time__gte=cutoff_time).values( 'url__url', 'url__protocol__protocol', 'url__mirror__country', - 'error').annotate(Count('error'), Max('check_time')) + 'error').annotate( + error_count=Count('error'), last_occurred=Max('check_time') + ).order_by('-last_occurred', '-error_count') + + last_check = max([u.last_check for u in urls]) good_urls = [] bad_urls = [] @@ -93,6 +97,7 @@ def status(request): good_urls.append(url) context = { + 'last_check': last_check, 'good_urls': good_urls, 'bad_urls': bad_urls, 'error_logs': error_logs, -- cgit v1.2.3-54-g00ecf