From 8f3c8017f12c2bcd135ab657b01d78e89f6da1a7 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 4 Jul 2016 16:29:54 -0400 Subject: [PATCH] Track total payments on any donation --- cronjob.py | 1 + fosspay/objects.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/cronjob.py b/cronjob.py index 986d007..973ad5c 100755 --- a/cronjob.py +++ b/cronjob.py @@ -40,6 +40,7 @@ for donation in donations: send_thank_you(user, donation.amount, donation.type == DonationType.monthly) donation.updated = datetime.now() + donation.payments += 1 db.commit() else: print("Skipping {}".format(donation)) diff --git a/fosspay/objects.py b/fosspay/objects.py index 5e70c04..c17db0d 100644 --- a/fosspay/objects.py +++ b/fosspay/objects.py @@ -62,6 +62,7 @@ class Donation(Base): updated = Column(DateTime, nullable=False) comment = Column(String(512)) active = Column(Boolean) + payments = Column(Integer) def __init__(self, user, type, amount, project=None, comment=None): self.user = user @@ -73,6 +74,7 @@ class Donation(Base): self.project = project self.comment = comment self.active = True + self.payments = 1 def __repr__(self): return "".format(