summaryrefslogtreecommitdiff
path: root/mirrors/views.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-09-21 17:30:14 -0500
committerDan McGee <dan@archlinux.org>2010-09-21 17:30:14 -0500
commit2a296af10d34c65e0f94d1a5b70c84ba31596ba4 (patch)
treec43da4573b7e14faca7c7211a57e9fa7e56ad376 /mirrors/views.py
parentb8a78408ff194ca2f822979fec5598778eff5826 (diff)
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 <dan@archlinux.org>
Diffstat (limited to 'mirrors/views.py')
-rw-r--r--mirrors/views.py9
1 files changed, 7 insertions, 2 deletions
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,