SciPost Code Repository

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

Add ordering by impact on reserves (for FinAdmin) in org list

parent 54ac2d64
No related branches found
No related tags found
No related merge requests found
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
<tr> <tr>
<th><a href="{% add_get_parameters order_by='country' %}">Country</a></th> <th><a href="{% add_get_parameters order_by='country' %}">Country</a></th>
<th><a href="{% add_get_parameters order_by='name' %}">Name</a>&nbsp;&nbsp;<small>[acronym]</small></th> <th><a href="{% add_get_parameters order_by='name' %}">Name</a>&nbsp;&nbsp;<small>[acronym]</small></th>
<th>NAP <span data-bs-toggle="tooltip" data-bs-html="true" title="" data-original-title="Number of associated publications<br/>For details, click on the Organization and consult the Associated Publications tab">{% include 'bi/info-circle-fill.html' %}</span> <th>NAP <span data-bs-toggle="tooltip" data-bs-html="true" title="" data-original-title="Number of associated publications<br/>For details, click on the Organization and consult the Associated Publications tab">{% include 'bi/info-circle-fill.html' %}</span><br>
{% if request.GET.ordering != 'asc' %} {% if request.GET.ordering != 'asc' %}
<a href="{% add_get_parameters order_by='nap' ordering='asc' %}">{% include 'bi/sort-up.html' %}</a> <a href="{% add_get_parameters order_by='nap' ordering='asc' %}">{% include 'bi/sort-up.html' %}</a>
{% else %} {% else %}
...@@ -124,7 +124,18 @@ ...@@ -124,7 +124,18 @@
</th> </th>
<th>SciPost sponsor?</th> <th>SciPost sponsor?</th>
{% if 'finadmin' in user_roles %} {% if 'finadmin' in user_roles %}
<th class="border border-danger bg-danger bg-opacity-10"><span class="text-danger">FinAdmin</span><br>Impact&nbsp;on<br>reserves</th> <th class="border border-danger bg-danger bg-opacity-10"><span class="text-danger">FinAdmin</span><br>Impact&nbsp;on<br>reserves<br>
{% if request.GET.ordering != 'asc' %}
<a href="{% add_get_parameters order_by='impact' ordering='asc' %}">{% include 'bi/sort-up.html' %}</a>
{% else %}
<a href="{% url 'organizations:organizations' %}">{% include 'bi/sort-up.html' %}</a>
{% endif %}
{% if request.GET.ordering != 'desc' %}
<a href="{% add_get_parameters order_by='impact' ordering='desc' %}">{% include 'bi/sort-down.html' %}</a>
{% else %}
<a href="{% url 'organizations:organizations' %}">{% include 'bi/sort-down.html' %}</a>
{% endif %}
</th>
{% endif %} {% endif %}
</tr> </tr>
</thead> </thead>
......
...@@ -166,6 +166,8 @@ class OrganizationListView(PaginationMixin, ListView): ...@@ -166,6 +166,8 @@ class OrganizationListView(PaginationMixin, ListView):
qs = qs.exclude(cf_nr_associated_publications__isnull=True).order_by( qs = qs.exclude(cf_nr_associated_publications__isnull=True).order_by(
"cf_nr_associated_publications" "cf_nr_associated_publications"
) )
elif order_by == "impact":
qs = qs.order_by("cf_balance_info__cumulative__impact_on_reserves")
if ordering == "desc": if ordering == "desc":
qs = qs.reverse() qs = qs.reverse()
return qs.prefetch_related("logos") return qs.prefetch_related("logos")
......
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