diff options
author | Dan McGee <dan@archlinux.org> | 2012-11-11 21:55:37 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-11-11 22:12:20 +0100 |
commit | e26d5722289bd2e972633891d8dac09296b0cbc4 (patch) | |
tree | fa4fb76f36be54a44c08c72e4e19601d987d2de9 | |
parent | 923ebbb53abf1d77a2f21b76e88faa085251af78 (diff) | |
download | archweb-e26d5722289bd2e972633891d8dac09296b0cbc4.tar.gz archweb-e26d5722289bd2e972633891d8dac09296b0cbc4.tar.xz |
Mirror graph tweaking after usage with real data
* Clamp y-axis minimum to 0.
* Don't plot `is_success == false` values.
* Ensure URLs are sorted predictably.
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | mirrors/static/mirror_status.js | 5 | ||||
-rw-r--r-- | mirrors/utils.py | 3 | ||||
-rw-r--r-- | mirrors/views.py | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/mirrors/static/mirror_status.js b/mirrors/static/mirror_status.js index 1c352a9..decc8fb 100644 --- a/mirrors/static/mirror_status.js +++ b/mirrors/static/mirror_status.js @@ -25,7 +25,7 @@ function mirror_status(chart_id, data_url) { d3.max(data, function(c) { return d3.max(c.logs, function(v) { return v.check_time; }); }) ]).nice(d3.time.hour); y.domain([ - d3.min(data, function(c) { return d3.min(c.logs, function(v) { return v.duration; }); }), + 0, d3.max(data, function(c) { return d3.max(c.logs, function(v) { return v.duration; }); }) ]).nice(); @@ -111,6 +111,9 @@ function mirror_status(chart_id, data_url) { return { url: url.url, logs: jQuery.map(url.logs, function(log, j) { + if (!log.is_success) { + return null; + } return { duration: log.duration, check_time: new Date(log.check_time) diff --git a/mirrors/utils.py b/mirrors/utils.py index ba027c9..85e4ee9 100644 --- a/mirrors/utils.py +++ b/mirrors/utils.py @@ -41,7 +41,8 @@ def get_mirror_statuses(cutoff=DEFAULT_CUTOFF, mirror_ids=None): success_count=Count('logs__duration'), last_sync=Max('logs__last_sync'), last_check=Max('logs__check_time'), - duration_avg=Avg('logs__duration')) + duration_avg=Avg('logs__duration')).order_by( + 'mirror', 'url') if mirror_ids: urls = urls.filter(mirror_id__in=mirror_ids) diff --git a/mirrors/views.py b/mirrors/views.py index be01e91..5e374b4 100644 --- a/mirrors/views.py +++ b/mirrors/views.py @@ -189,8 +189,6 @@ def mirror_details_json(request, name): status_info = get_mirror_statuses(mirror_ids=[mirror.id]) data = status_info.copy() data['version'] = 3 - # include only URLs for this particular mirror - data['urls'] = [url for url in data['urls'] if url.mirror_id == mirror.id] to_json = json.dumps(data, ensure_ascii=False, cls=ExtendedMirrorStatusJSONEncoder) response = HttpResponse(to_json, mimetype='application/json') |