Reduced the size of stats data transferred from the server by an order of magnitude for author stats pages by not sending complete lists of item names per table item (we're only displaying them when there are few to display, anyway). Added caching of the resulting stats data for 24 hours. The caching was not possible in all cases before the data reduction, due to an item size limit of 1 MByte in memcached.

- Legacy-Id: 13534
This commit is contained in:
Henrik Levkowetz 2017-06-05 22:32:15 +00:00
parent 91b4063669
commit 20b4250ea5
17 changed files with 716 additions and 698 deletions

View file

@ -883,6 +883,8 @@ SILENCED_SYSTEM_CHECKS = [
"fields.W342", # Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
]
STATS_NAMES_LIMIT = 25
# Put the production SECRET_KEY in settings_local.py, and also any other
# sensitive or site-specific changes. DO NOT commit settings_local.py to svn.
from settings_local import * # pyflakes:ignore pylint: disable=wildcard-import

File diff suppressed because it is too large Load diff

View file

@ -53,7 +53,7 @@
</tr>
</thead>
<tbody>
{% for affiliation, percentage, names in table_data %}
{% for affiliation, percentage, count, names in table_data %}
<tr>
<td>{{ affiliation|default:"(unknown)" }}</td>
<td>{{ percentage|floatformat:2 }}%</td>

View file

@ -58,7 +58,7 @@
</tr>
</thead>
<tbody>
{% for citations, percentage, names in table_data %}
{% for citations, percentage, count, names in table_data %}
<tr>
<td>{{ citations }}</td>
<td>{{ percentage|floatformat:2 }}%</td>

View file

@ -53,7 +53,7 @@
</tr>
</thead>
<tbody>
{% for continent, percentage, names in table_data %}
{% for continent, percentage, count, names in table_data %}
<tr>
<td>{{ continent|default:"(unknown)" }}</td>
<td>{{ percentage|floatformat:2 }}%</td>

View file

@ -53,7 +53,7 @@
</tr>
</thead>
<tbody>
{% for country, percentage, names in table_data %}
{% for country, percentage, count, names in table_data %}
<tr>
<td>{{ country|default:"(unknown)" }}</td>
<td>{{ percentage|floatformat:2 }}%</td>

View file

@ -59,7 +59,7 @@
</tr>
</thead>
<tbody>
{% for document_count, percentage, names in table_data %}
{% for document_count, percentage, count, names in table_data %}
<tr>
<td>{{ document_count }}</td>
<td>{{ percentage|floatformat:2 }}%</td>

View file

@ -58,7 +58,7 @@
</tr>
</thead>
<tbody>
{% for h_index, percentage, names in table_data %}
{% for h_index, percentage, count, names in table_data %}
<tr>
<td>{{ h_index }}</td>
<td>{{ percentage|floatformat:2 }}%</td>

View file

@ -58,7 +58,7 @@
</tr>
</thead>
<tbody>
{% for author_count, percentage, names in table_data %}
{% for author_count, percentage, count, names in table_data %}
<tr>
<td>{{ author_count }}</td>
<td>{{ percentage|floatformat:2 }}%</td>

View file

@ -54,7 +54,7 @@
</tr>
</thead>
<tbody>
{% for pages, percentage, names in table_data %}
{% for pages, percentage, count, names in table_data %}
<tr>
<td>{{ pages }}</td>
<td>{{ percentage|floatformat:2 }}%</td>

View file

@ -54,7 +54,7 @@
</tr>
</thead>
<tbody>
{% for formal_language, percentage, names in table_data %}
{% for formal_language, percentage, count, names in table_data %}
<tr>
<td>{{ formal_language }}</td>
<td>{{ percentage|floatformat:2 }}%</td>

View file

@ -52,7 +52,7 @@
</tr>
</thead>
<tbody>
{% for pages, percentage, names in table_data %}
{% for pages, percentage, count, names in table_data %}
<tr>
<td>{{ pages }}</td>
<td>{{ percentage|floatformat:2 }}%</td>

View file

@ -52,7 +52,7 @@
</tr>
</thead>
<tbody>
{% for pages, percentage, names in table_data %}
{% for pages, percentage, count, names in table_data %}
<tr>
<td>{{ pages }}</td>
<td>{{ percentage|floatformat:2 }}%</td>

View file

@ -1,8 +1,8 @@
{% if content_limit and names|length <= content_limit %}
{% if content_limit and count <= content_limit %}
{% for n in names %}
{{ n }}<br>
{% endfor %}
{% else %}
{# <a class="popover-details" href="" data-elements="{% for n in names|slice:":20" %}{{ n }}{% if not forloop.last %}|{% endif %}{% endfor %}" data-sliced="{% if names|length > 20 %}1{% endif %}">{{ names|length }}</a> #}
{{ names|length }}
{# <a class="popover-details" href="" data-elements="{% for n in names|slice:":20" %}{{ n }}{% if not forloop.last %}|{% endif %}{% endfor %}" data-sliced="{% if count > 20 %}1{% endif %}">{{ count }}</a> #}
{{ count }}
{% endif %}

View file

@ -53,7 +53,7 @@
</tr>
</thead>
<tbody>
{% for continent, percentage, names in table_data %}
{% for continent, percentage, count, names in table_data %}
<tr>
<td>{{ continent|default:"(unknown)" }}</td>
<td>{{ percentage|floatformat:2 }}%</td>

View file

@ -83,7 +83,7 @@
</tr>
</thead>
<tbody>
{% for country, percentage, names in table_data %}
{% for country, percentage, count, names in table_data %}
<tr>
<td>{{ country|default:"(unknown)" }}</td>
<td>{{ percentage|floatformat:2 }}%</td>

View file

@ -65,7 +65,7 @@
</tr>
</thead>
<tbody>
{% for meeting_number, label, url, names in table_data %}
{% for meeting_number, label, url, count, names in table_data %}
<tr>
<td><a href="{{ url }}">{{ label }}</a></td>
<td>{% include "stats/includes/number_with_details_cell.html" %}</td>