-
{{ card.height_display }}
-
- {% for t in card.height_star_types %}
-
{% if t == 'empty' %}☆{% else %}★{% endif %}
- {% endfor %}
+
+
+
Height
+
+
{{ card.height_display }}
+
+ {% for t in card.height_star_types %}
+ {% if t == 'empty' %}☆{% else %}★{% endif %}
+ {% endfor %}
+
-
+ {% endwith %}
+
{% if card.facts_list %}
Fun facts
diff --git a/cards/views.py b/cards/views.py
index 7ea1914..4f10f61 100644
--- a/cards/views.py
+++ b/cards/views.py
@@ -456,6 +456,31 @@ def print_preview(request):
for i in range(0, len(ordered), per_page):
pages.append(ordered[i:i+per_page])
+ # -- Top-trump calculation across the full selection -----------------
+ # For each card compute its best stat percent (0-100) and the stat(s)
+ # that achieve that percent. Then find the global maximum best-value and
+ # mark any card whose best-value equals that maximum as a top-trump.
+ all_best_values = []
+ for c in ordered:
+ # compute percents using model helpers
+ s = c.speed_percent()
+ w = c.weight_percent()
+ it = c.intelligence_percent()
+ h = c.height_percent()
+ # map names to values
+ stats = {'speed': s, 'weight': w, 'intelligence': it, 'height': h}
+ max_val = max(stats.values())
+ best_stats = [name for name, val in stats.items() if val == max_val]
+ # attach computed attributes so templates can read them
+ setattr(c, 'best_value', max_val)
+ setattr(c, 'best_stats', best_stats)
+ all_best_values.append(max_val)
+ # determine global maximum and mark cards as top-trump if they match
+ global_max = max(all_best_values) if all_best_values else 0
+ for c in ordered:
+ setattr(c, 'is_top_trump', getattr(c, 'best_value', 0) == global_max)
+ # ---------------------------------------------------------------------
+
# Determine grid columns for layout: use 1 column for 1-up, 2 columns for 2/4-up
columns = 1 if per_page == 1 else 2
diff --git a/db.sqlite3 b/db.sqlite3
index b93ff93..a685a3f 100644
Binary files a/db.sqlite3 and b/db.sqlite3 differ