133 lines
4.3 KiB
HTML
133 lines
4.3 KiB
HTML
{# bs5ok #}
|
|
{% 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>
|
|
<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>
|
|
</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">
|
|
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>
|
|
{% 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 %}
|
|
</table>
|
|
{% endif %}
|
|
{% else %}
|
|
<p>
|
|
<a href="{{ show_aliases_url }}" class="btn btn-primary">Show generated aliases</a>
|
|
</p>
|
|
{% endif %}
|