Add ability to hide specific recurring payments

I use fosspay for billing consulting contracts as well as accepting
donations, and I don't want these to show up in the sum.
This commit is contained in:
Drew DeVault 2018-08-25 09:41:24 -04:00
parent b1a2e820e5
commit d8440a03ff
2 changed files with 5 additions and 2 deletions

View File

@ -33,7 +33,8 @@ def index():
selected_project = None
active_recurring = (Donation.query
.filter(Donation.type == DonationType.monthly)
.filter(Donation.active == True))
.filter(Donation.active == True)
.filter(Donation.hidden == False))
recurring_count = active_recurring.count()
recurring_sum = sum([d.amount for d in active_recurring])

View File

@ -27,7 +27,8 @@ class User(Base):
stripe_customer = Column(String(256))
def set_password(self, password):
self.password = bcrypt.hashpw(password.encode("utf-8"), bcrypt.gensalt()).decode("utf-8")
self.password = bcrypt.hashpw(password.encode("utf-8"),
bcrypt.gensalt()).decode("utf-8")
def __init__(self, email, password):
self.email = email
@ -63,6 +64,7 @@ class Donation(Base):
comment = Column(String(512))
active = Column(Boolean)
payments = Column(Integer)
hidden = Column(Boolean, server_default='f', nullable=False)
def __init__(self, user, type, amount, project=None, comment=None):
self.user = user