From 6dbe266bd596431f385f8cd74719f55db76cac8f Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Fri, 17 Jul 2015 13:40:42 +0200 Subject: [PATCH] Remove unused methods. --- accountant/api/models/operations.py | 30 ----------------------------- 1 file changed, 30 deletions(-) diff --git a/accountant/api/models/operations.py b/accountant/api/models/operations.py index a7a4a6f..434059a 100644 --- a/accountant/api/models/operations.py +++ b/accountant/api/models/operations.py @@ -47,14 +47,6 @@ class Operation(db.Model): self.account_id = account_id self.category = category - @classmethod - def get_for_account_and_month(cls, session, account, year, month): - begin = arrow.get(year, month, 1) - end = begin.ceil('month') - - return cls.get_for_account_and_range(session, account, begin.date(), - end.date()) - @classmethod def get_for_account_and_range(cls, session, account, begin, end): if isinstance(account, int) or isinstance(account, str): @@ -82,28 +74,6 @@ class Operation(db.Model): return query - @classmethod - def get_account_status(cls, session, account, year, month): - if isinstance(account, int) or isinstance(account, str): - account_id = account - else: - account_id = account.id - - query = session.query( - func.sum(case([(func.sign(cls.value) == -1, cls.value)], - else_=0)).label("expenses"), - func.sum(case([(func.sign(cls.value) == 1, cls.value)], - else_=0)).label("revenues"), - func.sum(cls.value).label("balance") - ).filter( - cls.account_id == account_id - ).filter( - func.date_trunc('month', - cls.operation_date) == "%s-%s-01" % (year, month) - ).group_by(cls.account_id) - - return query - @classmethod def get(cls, session, id): return session.query(cls).filter(cls.id == id).one()