From 0c2d0e80ab9af8281a12acd2861cf153ad7f1a7d Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Mon, 17 Apr 2023 20:42:52 +0200
Subject: [PATCH] Invert the paper counter and list the total at the top

---
 query.py            |  3 ++-
 templates/pubs.html | 29 +++++++++++++++++------------
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/query.py b/query.py
index 89fabf1..bf02a91 100644
--- a/query.py
+++ b/query.py
@@ -12,7 +12,8 @@ for paper in paper_list:
     paper.title = paper.title[0]
     
 # Create a dictionary of cards
-my_list = dict({"cards": paper_list})
+my_list = dict({"num_papers": query_data.num_found,
+                "cards": paper_list})
 
 # Silence the yaml object naming
 def noop(self, *args, **kw):
diff --git a/templates/pubs.html b/templates/pubs.html
index 8a1c842..6f90e17 100644
--- a/templates/pubs.html
+++ b/templates/pubs.html
@@ -9,19 +9,24 @@
     <div class="container">
       {{ helper.navbar(navbar, link) }}
 
-       <div class="text">
-         <h2>Publications using SWIFT</h2>
-       </div>
+      <br/>
+      <div class="text">
+        <h2>Publications using SWIFT</h2>
+      </div>
+      
+      <div> The following {{ num_papers }} have made use of SWIFT for their results:</div>
+      
+       {% set count  = num_papers %}
       
        {% for card in cards|sort_cards %}
-       <div class="card-text">
-         <h4>{{ loop.index }}) <a href="https://ui.adsabs.harvard.edu/abs/{{ card.bibcode }}/abstract">{{ card.title }}</h4></a>
-	 {% if card.author_count > 1 %}
-         <p>{{ card.first_author_norm }} et al., {{ card.year }}</p>
-	 {% else %}
-	 <p>{{ card.first_author_norm }}, {{ card.year }}</p>
-	 {% endif %}			  
-       </div>
-       {% endfor %}
+      <div class="card-text">
+        <h4>{{ count + 1 - loop.index }}) <a href="https://ui.adsabs.harvard.edu/abs/{{ card.bibcode }}/abstract">{{ card.title }}</h4></a>
+	{% if card.author_count > 1 %}
+        <p>{{ card.first_author_norm }} et al., {{ card.year }}</p>
+	{% else %}
+	<p>{{ card.first_author_norm }}, {{ card.year }}</p>
+	{% endif %}			  
+      </div>
+      {% endfor %}
     </div>
 {% endblock %}
-- 
GitLab