From 7dc370baa37cdc03eeb3677844b4e124a4d155a9 Mon Sep 17 00:00:00 2001 From: Ole Laursen Date: Fri, 6 Jan 2017 15:31:32 +0000 Subject: [PATCH] Improve wording a bit in the document statistics, turn of chart animation, it makes the page seem sluggish - Legacy-Id: 12630 --- ietf/stats/urls.py | 2 +- ietf/stats/views.py | 41 ++++++++++++------- ietf/templates/stats/document_stats.html | 6 +-- .../stats/document_stats_authors.html | 9 +++- 4 files changed, 37 insertions(+), 21 deletions(-) diff --git a/ietf/stats/urls.py b/ietf/stats/urls.py index 641187350..82fcd5743 100644 --- a/ietf/stats/urls.py +++ b/ietf/stats/urls.py @@ -5,6 +5,6 @@ import ietf.stats.views urlpatterns = patterns('', url("^$", ietf.stats.views.stats_index), - url("^document/(?:(?Pauthors|pages|format|spectech)/)?(?:(?Pall|rfc|draft)/)?$", ietf.stats.views.document_stats), + url("^document/(?:(?Pauthors|pages|format|spectech)/)?(?:(?Pall|rfc|draft)/)?$", ietf.stats.views.document_stats), url("^review/(?:(?Pcompletion|results|states|time)/)?(?:%(acronym)s/)?$" % settings.URL_REGEXPS, ietf.stats.views.review_stats), ) diff --git a/ietf/stats/views.py b/ietf/stats/views.py index 63b3da920..77c527157 100644 --- a/ietf/stats/views.py +++ b/ietf/stats/views.py @@ -49,11 +49,11 @@ def generate_query_string(query_dict, overrides): return query_part -def document_stats(request, stats_type=None, document_state=None): - def build_document_stats_url(stats_type_override=Ellipsis, document_state_override=Ellipsis, get_overrides={}): +def document_stats(request, stats_type=None, document_type=None): + def build_document_stats_url(stats_type_override=Ellipsis, document_type_override=Ellipsis, get_overrides={}): kwargs = { "stats_type": stats_type if stats_type_override is Ellipsis else stats_type_override, - "document_state": document_state if document_state_override is Ellipsis else document_state_override, + "document_type": document_type if document_type_override is Ellipsis else document_type_override, } return urlreverse(document_stats, kwargs={ k: v for k, v in kwargs.iteritems() if v is not None }) + generate_query_string(request.GET, get_overrides) @@ -72,33 +72,42 @@ def document_stats(request, stats_type=None, document_state=None): if not stats_type: return HttpResponseRedirect(build_document_stats_url(stats_type_override=possible_stats_types[0][0])) - possible_document_states = [ + possible_document_types = [ ("all", "All"), ("rfc", "RFCs"), - ("draft", "Drafts (not published as RFC)"), + ("draft", "Drafts"), ] - possible_document_states = [ (slug, label, build_document_stats_url(document_state_override=slug)) - for slug, label in possible_document_states ] + possible_document_types = [ (slug, label, build_document_stats_url(document_type_override=slug)) + for slug, label in possible_document_types ] - if not document_state: - return HttpResponseRedirect(build_document_stats_url(document_state_override=possible_document_states[0][0])) + if not document_type: + return HttpResponseRedirect(build_document_stats_url(document_type_override=possible_document_types[0][0])) # filter documents doc_qs = Document.objects.filter(type="draft") - if document_state == "rfc": + if document_type == "rfc": doc_qs = doc_qs.filter(states__type="draft", states__slug="rfc") - elif document_state == "draft": + elif document_type == "draft": doc_qs = doc_qs.exclude(states__type="draft", states__slug="rfc") chart_data = [] table_data = [] + + if document_type == "all": + doc_label = "document" + elif document_type == "rfc": + doc_label = "RFC" + elif document_type == "draft": + doc_label = "draft" + stats_title = "" if stats_type == "authors": - stats_title = "Number of authors for each document" + + stats_title = "Number of authors for each {}".format(doc_label) groups = defaultdict(list) @@ -114,7 +123,8 @@ def document_stats(request, stats_type=None, document_state=None): chart_data.append({ "data": series_data, - "name": "Percentage of documents", + "name": "Percentage of {}s".format(doc_label), + "animation": False, }) @@ -124,8 +134,9 @@ def document_stats(request, stats_type=None, document_state=None): "stats_title": stats_title, "possible_stats_types": possible_stats_types, "stats_type": stats_type, - "possible_document_states": possible_document_states, - "document_state": document_state, + "possible_document_types": possible_document_types, + "document_type": document_type, + "doc_label": doc_label, }) @login_required diff --git a/ietf/templates/stats/document_stats.html b/ietf/templates/stats/document_stats.html index e11aaed4e..0ba8e3ccb 100644 --- a/ietf/templates/stats/document_stats.html +++ b/ietf/templates/stats/document_stats.html @@ -26,10 +26,10 @@
- Document types: + Document type:
- {% for slug, label, url in possible_document_states %} - {{ label }} + {% for slug, label, url in possible_document_types %} + {{ label }} {% endfor %}
diff --git a/ietf/templates/stats/document_stats_authors.html b/ietf/templates/stats/document_stats_authors.html index 3ecc19562..4548ae58b 100644 --- a/ietf/templates/stats/document_stats_authors.html +++ b/ietf/templates/stats/document_stats_authors.html @@ -7,6 +7,12 @@ chart: { type: 'column' }, + credits: { + enabled: false, + }, + exporting: { + fallbackToExportServer: false, + }, title: { text: '{{ stats_title|escapejs }}' }, @@ -18,7 +24,7 @@ }, yAxis: { title: { - text: 'Percentage of documents' + text: 'Percentage of {{ doc_label }}s' }, labels: { formatter: function () { @@ -32,7 +38,6 @@ tooltip: { formatter: function () { var s = '' + this.x + ' ' + (this.x == 1 ? "author" : 'authors') + ''; - console.log(this.points) $.each(this.points, function () { s += '
' + this.series.name + ': ' +