From 55da2573a4ee3943ed97aee6fa726eee1d81c1b9 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Fri, 26 Mar 2021 01:07:51 -0700 Subject: [PATCH] show last payout in stats table --- app/models.py | 6 ++++++ app/templates/stats.html | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/models.py b/app/models.py index 58be233..8e033bc 100644 --- a/app/models.py +++ b/app/models.py @@ -36,6 +36,12 @@ class Operation(db.Model): b = cache.get_balances(self.account_idx, atomic=atomic) return b + def get_last_payout(self): + last_payout = Payout.query.filter( + Payout.operation_id == self.id + ).order_by(Payout.create_date.desc()).first() + return last_payout + def get_pricing(self, live=False): if live: droplet_size = cache.show_droplet(self.droplet_id)['size_slug'] diff --git a/app/templates/stats.html b/app/templates/stats.html index 99c8399..4a3df7b 100644 --- a/app/templates/stats.html +++ b/app/templates/stats.html @@ -21,6 +21,7 @@ XMR Account Droplet ID Volume ID + Last Payout Balances {% for op in all_ops['active'] | sort(attribute='create_date', reverse=True) %} @@ -32,8 +33,9 @@ {{ op.codename }} {{ op.account_idx }} {{ op.droplet_id }} - {{ op.volume_id }} - {{ unlocked }} XMR ({{ locked }} locked) + {{ op.volume_id }} + {{ op.get_last_payout().create_date | humanize }} + {{ unlocked }} XMR ({{ locked }} locked) {% endfor %}