Skip to content

Commit

Permalink
Use 'amount_won' for gift card total in admin view
Browse files Browse the repository at this point in the history
  • Loading branch information
davepeck committed Apr 26, 2024
1 parent 627396e commit 24f84fe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/vb/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""


Expand Down

0 comments on commit 24f84fe

Please sign in to comment.