diff options
author | Dan McGee <dan@archlinux.org> | 2015-02-26 18:34:21 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2015-02-26 18:34:21 -0600 |
commit | 8afa3cc2df4d3a53eec44b1b977b0b50b096617d (patch) | |
tree | 8a06deb5ac16a906fa8dbff1e87727534ea58aac /mirrors | |
parent | f3214b4b03cc7cc8c4317aae8c8f3353c3f01049 (diff) |
Add details links to third mirror status table
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors')
-rw-r--r-- | mirrors/utils.py | 9 | ||||
-rw-r--r-- | mirrors/views.py | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/mirrors/utils.py b/mirrors/utils.py index 930adb8d..533cd452 100644 --- a/mirrors/utils.py +++ b/mirrors/utils.py @@ -159,9 +159,7 @@ def get_mirror_errors(cutoff=DEFAULT_CUTOFF, mirror_id=None, show_all=False): cutoff_time = now() - cutoff errors = MirrorLog.objects.filter( is_success=False, check_time__gte=cutoff_time, - url__mirror__public=True).values( - 'url__url', 'url__country', 'url__protocol__protocol', - 'url__mirror__tier', 'error').annotate( + url__mirror__public=True).values('url__id', 'error').annotate( error_count=Count('error'), last_occurred=Max('check_time') ).order_by('-last_occurred', '-error_count') @@ -172,8 +170,11 @@ def get_mirror_errors(cutoff=DEFAULT_CUTOFF, mirror_id=None, show_all=False): url__mirror__public=True) errors = list(errors) + to_fetch = [err['url__id'] for err in errors] + urls = MirrorUrl.objects.select_related( + 'mirror', 'protocol').in_bulk(to_fetch) for err in errors: - err['country'] = Country(err['url__country'], flag_url='') + err['url'] = urls[err['url__id']] return errors diff --git a/mirrors/views.py b/mirrors/views.py index 65fa0123..9c01bc22 100644 --- a/mirrors/views.py +++ b/mirrors/views.py @@ -274,7 +274,7 @@ def status(request, tier=None): error_logs = get_mirror_errors() if tier is not None: error_logs = [log for log in error_logs - if log['url__mirror__tier'] == tier] + if log['url'].mirror.tier == tier] context = status_info.copy() context.update({ |