From 11fed2d8104a57375b7e48020a75b614fc03eef9 Mon Sep 17 00:00:00 2001 From: Joel Date: Mon, 27 Mar 2023 22:57:54 -0400 Subject: [PATCH 1/2] Fix #1100 not adding the total_donations if the donation has been refunded --- subscribie/blueprints/admin/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/subscribie/blueprints/admin/__init__.py b/subscribie/blueprints/admin/__init__.py index 9c401c4f..6f5c438a 100644 --- a/subscribie/blueprints/admin/__init__.py +++ b/subscribie/blueprints/admin/__init__.py @@ -467,9 +467,10 @@ def dashboard(): if Setting.query.first().donations_enabled is True: donation_transactions = Transaction.query.filter_by(is_donation=True).all() for donations in donation_transactions: - total_donations = donations.amount + total_donations - currency_code = get_geo_currency_code() - total_donations = currencyFormat(currency_code, total_donations) + if donations.external_refund_id is None: + total_donations = donations.amount + total_donations + currency_code = get_geo_currency_code() + total_donations = currencyFormat(currency_code, total_donations) return render_template( "admin/dashboard.html", stripe_connected=stripe_connected, From ebdefc4e43af653dea0e0c1cac3f93043a309b44 Mon Sep 17 00:00:00 2001 From: Joel Date: Mon, 27 Mar 2023 23:04:01 -0400 Subject: [PATCH 2/2] adding comments to the line --- subscribie/blueprints/admin/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subscribie/blueprints/admin/__init__.py b/subscribie/blueprints/admin/__init__.py index 6f5c438a..0a9a9c15 100644 --- a/subscribie/blueprints/admin/__init__.py +++ b/subscribie/blueprints/admin/__init__.py @@ -467,6 +467,8 @@ def dashboard(): if Setting.query.first().donations_enabled is True: donation_transactions = Transaction.query.filter_by(is_donation=True).all() for donations in donation_transactions: + # transactions have a refund id which are saved in the transaction table + # Named as external_refund_id so we are skipping those transactions to get the total. if donations.external_refund_id is None: total_donations = donations.amount + total_donations currency_code = get_geo_currency_code()