forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocument_stats_author_country.html
More file actions
136 lines (134 loc) · 4.54 KB
/
document_stats_author_country.html
File metadata and controls
136 lines (134 loc) · 4.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
{% load origin %}
{% origin %}
<div id="chart"></div>
<script>
var chartConf = {
chart: {
type: 'column'
},
plotOptions: {
column: {
animation: false
}
},
title: {
text: '{{ stats_title|escapejs }}'
},
xAxis: {
type: "category",
title: {
text: 'Country'
}
},
yAxis: {
title: {
text: 'Number of authors'
}
},
tooltip: {
formatter: function () {
var s = '<b>' + this.points[0].key + '</b>';
$.each(this.points, function () {
s += '<br>' + chartConf.yAxis.title.text + ': ' + this.y;
});
return s;
},
shared: true
},
series: {{ chart_data }}
};
</script>
<h2>Data</h2>
<table class="table table-sm table-striped tablesorter stats-data">
<thead>
<tr>
<th data-sort="country">Country</th>
<th class="text-end" data-sort="percentage">Percentage of authors</th>
<th class="text-end" data-sort="authors">Authors</th>
</tr>
</thead>
{% if table_data %}
<tbody>
{% for country, percentage, count, names in table_data %}
<tr>
<td>{{ country|default:"(unknown)" }}</td>
<td class="text-end">{{ percentage|floatformat:2 }}%</td>
<td class="text-end">{% include "stats/includes/number_with_details_cell.html" %}</td>
</tr>
{% endfor %}
</tbody>
{% endif %}
</table>
<p>
The statistics are based entirely on the author addresses provided
with each draft. Since this varies across documents, a traveling
author may be counted in more than country, making the total sum
more than 100%.
</p>
<p>
In case no country information is found for an author in the time
period, the author is counted as (unknown).
</p>
<p>
EU (European Union) is not a country, but has been added for reference, as the sum of
all current EU member countries:
{% for c in eu_countries %}
{{ c.name }}{% if not forloop.last %},{% endif %}
{% endfor %}
.
</p>
<h2>Country Aliases</h2>
<p>
In generating the above statistics, some heuristics have been
applied to figure out which country each author is from.
</p>
{% if request.GET.showaliases %}
<p>
<a href="{{ hide_aliases_url }}" class="btn btn-primary">Hide generated aliases</a>
</p>
{% if request.user.is_staff %}
<p class="alert alert-info my-3">
Note: since you're an admin, some extra links are visible. You
can either correct a document author entry directly in case the
information is obviously missing or add an alias if an unknown
<a href="{% url "admin:name_countryname_changelist" %}">country name</a>
is being used.
</p>
{% endif %}
{% if alias_data %}
<table class="table table-sm table-striped tablesorter">
<thead>
<th data-sort="country">Country</th>
<th data-sort="alias">Alias</th>
</thead>
{% if alias_data %}
<tbody>
{% for name, alias, country in alias_data %}
<tr>
<td>
{% if country and request.user.is_staff %}
<a href="{% url "admin:name_countryname_change" country.pk %}">{{ name|default:"(unknown)" }}</a>
{% else %}
{{ name|default:"(unknown)" }}
{% endif %}
</td>
<td>
{{ alias }}
{% if request.user.is_staff and name != "EU" %}
<a class="float-end btn btn-primary btn-sm"
href="{% url "admin:doc_documentauthor_changelist" %}?country={{ alias|urlencode }}">
Matching authors
</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
{% endif %}
</table>
{% endif %}
{% else %}
<p>
<a href="{{ show_aliases_url }}" class="btn btn-primary">Show generated aliases</a>
</p>
{% endif %}