From 12462e883a2f3874267a77127dee8415b85b69f5 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 4 Jul 2016 16:20:04 -0400 Subject: [PATCH] Improve admin page --- fosspay/blueprints/html.py | 4 +++- templates/admin.html | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/fosspay/blueprints/html.py b/fosspay/blueprints/html.py index 0e1bbd0..1f4cb94 100644 --- a/fosspay/blueprints/html.py +++ b/fosspay/blueprints/html.py @@ -62,7 +62,9 @@ def admin(): one_times=lambda p: sum([d.amount for d in p.donations if d.type == DonationType.one_time]), recurring=lambda p: sum([d.amount for d in p.donations if d.type == DonationType.monthly]), unspecified_one_times=sum([d.amount for d in unspecified if d.type == DonationType.one_time]), - unspecified_recurring=sum([d.amount for d in unspecified if d.type == DonationType.monthly]) + unspecified_recurring=sum([d.amount for d in unspecified if d.type == DonationType.monthly]), + total_one_time=sum([d.amount for d in Donation.query.filter(Donation.type == DonationType.one_time)]), + total_recurring=sum([d.amount for d in Donation.query.filter(Donation.type == DonationType.recurring)]), ) @html.route("/create-project", methods=["POST"]) diff --git a/templates/admin.html b/templates/admin.html index 59b0a4a..e2ef179 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -74,6 +74,12 @@ ${{ "{:.2f}".format(unspecified_one_times / 100) }} ${{ "{:.2f}".format(unspecified_recurring / 100) }} + + + Total + ${{ "{:.2f}".format(total_one_time / 100) }} + ${{ "{:.2f}".format(total_recurring / 100) }} + @@ -92,6 +98,7 @@ + @@ -102,6 +109,7 @@ {% for donation in donations %} +
Date Email Project Comment
{{ donation.created.isoformat() }} {{ donation.user.email }} {{ donation.project.name if donation.project else "" }} {{ donation.comment if donation.comment else "" }}