SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 4a012a15 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Add counter for topic top experts

parent 62ca0ea1
No related branches found
No related tags found
No related merge requests found
...@@ -126,9 +126,9 @@ ...@@ -126,9 +126,9 @@
{% get_profiles topic.slug as profiles %} {% get_profiles topic.slug as profiles %}
{% for profile in profiles %} {% for profile in profiles %}
{% if profile.contributor %} {% if profile.contributor %}
<li><a href="{{ profile.contributor.get_absolute_url }}">{{ profile }}</a></li> <li><a href="{{ profile.contributor.get_absolute_url }}">{{ profile }}</a> ({{ profile.count }})</li>
{% else %} {% else %}
<li>{{ profile }}</li> <li>{{ profile }} ({{ profile.count }})</li>
{% endif %} {% endif %}
{% empty %} {% empty %}
<li>No Profile found</li> <li>No Profile found</li>
......
...@@ -140,7 +140,8 @@ def get_profiles(slug): ...@@ -140,7 +140,8 @@ def get_profiles(slug):
unreg_id_list = [tbl.unregistered_author.id for tbl in publications.all() \ unreg_id_list = [tbl.unregistered_author.id for tbl in publications.all() \
if tbl.unregistered_author is not None] if tbl.unregistered_author is not None]
return Profile.objects.filter(models.Q(contributor__id__in=cont_id_list) | return Profile.objects.filter(models.Q(contributor__id__in=cont_id_list) |
models.Q(unregisteredauthor__id__in=unreg_id_list)) models.Q(unregisteredauthor__id__in=unreg_id_list
)).annotate(count=models.Count('id')).distinct().order_by('-count')
class ProfileNonDuplicates(models.Model): class ProfileNonDuplicates(models.Model):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment