Track total payments on any donation

static-cp-fix
Drew DeVault 9 years ago
parent 8d320c8820
commit 8f3c8017f1
  1. 1
      cronjob.py
  2. 2
      fosspay/objects.py

@ -40,6 +40,7 @@ for donation in donations:
send_thank_you(user, donation.amount, donation.type == DonationType.monthly) send_thank_you(user, donation.amount, donation.type == DonationType.monthly)
donation.updated = datetime.now() donation.updated = datetime.now()
donation.payments += 1
db.commit() db.commit()
else: else:
print("Skipping {}".format(donation)) print("Skipping {}".format(donation))

@ -62,6 +62,7 @@ class Donation(Base):
updated = Column(DateTime, nullable=False) updated = Column(DateTime, nullable=False)
comment = Column(String(512)) comment = Column(String(512))
active = Column(Boolean) active = Column(Boolean)
payments = Column(Integer)
def __init__(self, user, type, amount, project=None, comment=None): def __init__(self, user, type, amount, project=None, comment=None):
self.user = user self.user = user
@ -73,6 +74,7 @@ class Donation(Base):
self.project = project self.project = project
self.comment = comment self.comment = comment
self.active = True self.active = True
self.payments = 1
def __repr__(self): def __repr__(self):
return "<Donation {} from {}: ${} ({})>".format( return "<Donation {} from {}: ${} ({})>".format(

Loading…
Cancel
Save