Skip to content

Commit 7dc370b

Browse files
committed
Improve wording a bit in the document statistics, turn of chart
animation, it makes the page seem sluggish - Legacy-Id: 12630
1 parent dac430c commit 7dc370b

4 files changed

Lines changed: 37 additions & 21 deletions

File tree

ietf/stats/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55

66
urlpatterns = patterns('',
77
url("^$", ietf.stats.views.stats_index),
8-
url("^document/(?:(?P<stats_type>authors|pages|format|spectech)/)?(?:(?P<document_state>all|rfc|draft)/)?$", ietf.stats.views.document_stats),
8+
url("^document/(?:(?P<stats_type>authors|pages|format|spectech)/)?(?:(?P<document_type>all|rfc|draft)/)?$", ietf.stats.views.document_stats),
99
url("^review/(?:(?P<stats_type>completion|results|states|time)/)?(?:%(acronym)s/)?$" % settings.URL_REGEXPS, ietf.stats.views.review_stats),
1010
)

ietf/stats/views.py

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ def generate_query_string(query_dict, overrides):
4949
return query_part
5050

5151

52-
def document_stats(request, stats_type=None, document_state=None):
53-
def build_document_stats_url(stats_type_override=Ellipsis, document_state_override=Ellipsis, get_overrides={}):
52+
def document_stats(request, stats_type=None, document_type=None):
53+
def build_document_stats_url(stats_type_override=Ellipsis, document_type_override=Ellipsis, get_overrides={}):
5454
kwargs = {
5555
"stats_type": stats_type if stats_type_override is Ellipsis else stats_type_override,
56-
"document_state": document_state if document_state_override is Ellipsis else document_state_override,
56+
"document_type": document_type if document_type_override is Ellipsis else document_type_override,
5757
}
5858

5959
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 build_document_stats_url(stats_type_override=Ellipsis, document_state_overri
7272
if not stats_type:
7373
return HttpResponseRedirect(build_document_stats_url(stats_type_override=possible_stats_types[0][0]))
7474

75-
possible_document_states = [
75+
possible_document_types = [
7676
("all", "All"),
7777
("rfc", "RFCs"),
78-
("draft", "Drafts (not published as RFC)"),
78+
("draft", "Drafts"),
7979
]
8080

81-
possible_document_states = [ (slug, label, build_document_stats_url(document_state_override=slug))
82-
for slug, label in possible_document_states ]
81+
possible_document_types = [ (slug, label, build_document_stats_url(document_type_override=slug))
82+
for slug, label in possible_document_types ]
8383

84-
if not document_state:
85-
return HttpResponseRedirect(build_document_stats_url(document_state_override=possible_document_states[0][0]))
84+
if not document_type:
85+
return HttpResponseRedirect(build_document_stats_url(document_type_override=possible_document_types[0][0]))
8686

8787

8888
# filter documents
8989
doc_qs = Document.objects.filter(type="draft")
9090

91-
if document_state == "rfc":
91+
if document_type == "rfc":
9292
doc_qs = doc_qs.filter(states__type="draft", states__slug="rfc")
93-
elif document_state == "draft":
93+
elif document_type == "draft":
9494
doc_qs = doc_qs.exclude(states__type="draft", states__slug="rfc")
9595

9696
chart_data = []
9797
table_data = []
98+
99+
if document_type == "all":
100+
doc_label = "document"
101+
elif document_type == "rfc":
102+
doc_label = "RFC"
103+
elif document_type == "draft":
104+
doc_label = "draft"
105+
98106
stats_title = ""
99107

100108
if stats_type == "authors":
101-
stats_title = "Number of authors for each document"
109+
110+
stats_title = "Number of authors for each {}".format(doc_label)
102111

103112
groups = defaultdict(list)
104113

@@ -114,7 +123,8 @@ def build_document_stats_url(stats_type_override=Ellipsis, document_state_overri
114123

115124
chart_data.append({
116125
"data": series_data,
117-
"name": "Percentage of documents",
126+
"name": "Percentage of {}s".format(doc_label),
127+
"animation": False,
118128
})
119129

120130

@@ -124,8 +134,9 @@ def build_document_stats_url(stats_type_override=Ellipsis, document_state_overri
124134
"stats_title": stats_title,
125135
"possible_stats_types": possible_stats_types,
126136
"stats_type": stats_type,
127-
"possible_document_states": possible_document_states,
128-
"document_state": document_state,
137+
"possible_document_types": possible_document_types,
138+
"document_type": document_type,
139+
"doc_label": doc_label,
129140
})
130141

131142
@login_required

ietf/templates/stats/document_stats.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ <h1>Document statistics</h1>
2626
</div>
2727

2828
<div>
29-
Document types:
29+
Document type:
3030
<div class="btn-group">
31-
{% for slug, label, url in possible_document_states %}
32-
<a class="btn btn-default {% if slug == document_state %}active{% endif %}" href="{{ url }}">{{ label }}</a>
31+
{% for slug, label, url in possible_document_types %}
32+
<a class="btn btn-default {% if slug == document_type %}active{% endif %}" href="{{ url }}">{{ label }}</a>
3333
{% endfor %}
3434
</div>
3535
</div>

ietf/templates/stats/document_stats_authors.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ <h3>{{ stats_title }}</h3>
77
chart: {
88
type: 'column'
99
},
10+
credits: {
11+
enabled: false,
12+
},
13+
exporting: {
14+
fallbackToExportServer: false,
15+
},
1016
title: {
1117
text: '{{ stats_title|escapejs }}'
1218
},
@@ -18,7 +24,7 @@ <h3>{{ stats_title }}</h3>
1824
},
1925
yAxis: {
2026
title: {
21-
text: 'Percentage of documents'
27+
text: 'Percentage of {{ doc_label }}s'
2228
},
2329
labels: {
2430
formatter: function () {
@@ -32,7 +38,6 @@ <h3>{{ stats_title }}</h3>
3238
tooltip: {
3339
formatter: function () {
3440
var s = '<b>' + this.x + ' ' + (this.x == 1 ? "author" : 'authors') + '</b>';
35-
console.log(this.points)
3641

3742
$.each(this.points, function () {
3843
s += '<br/>' + this.series.name + ': ' +

0 commit comments

Comments
 (0)