From 24f84fee8fa25d3145a4e9cc9f5cbb97693efc10 Mon Sep 17 00:00:00 2001 From: Dave <davepeck@gmail.com> Date: Fri, 26 Apr 2024 12:26:35 -0700 Subject: [PATCH] Use 'amount_won' for gift card total in admin view --- server/vb/admin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/vb/admin.py b/server/vb/admin.py index 3dfb22d..d635e64 100644 --- a/server/vb/admin.py +++ b/server/vb/admin.py @@ -193,7 +193,9 @@ def contest_entries(self, obj: Student) -> int | str: @admin.display(description="Gift Card Total") def gift_card_total(self, obj: Student) -> str | None: """Return the total number of gift cards the student has received.""" - usd = obj.contest_entries.aggregate(total=models.Sum("amount"))["total"] or 0 + usd = ( + obj.contest_entries.aggregate(total=models.Sum("amount_won"))["total"] or 0 + ) return f"${usd}" if usd > 0 else ""