Remove unused methods.
This commit is contained in:
parent
6441644adc
commit
6dbe266bd5
@ -47,14 +47,6 @@ class Operation(db.Model):
|
|||||||
self.account_id = account_id
|
self.account_id = account_id
|
||||||
self.category = category
|
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
|
@classmethod
|
||||||
def get_for_account_and_range(cls, session, account, begin, end):
|
def get_for_account_and_range(cls, session, account, begin, end):
|
||||||
if isinstance(account, int) or isinstance(account, str):
|
if isinstance(account, int) or isinstance(account, str):
|
||||||
@ -82,28 +74,6 @@ class Operation(db.Model):
|
|||||||
|
|
||||||
return query
|
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
|
@classmethod
|
||||||
def get(cls, session, id):
|
def get(cls, session, id):
|
||||||
return session.query(cls).filter(cls.id == id).one()
|
return session.query(cls).filter(cls.id == id).one()
|
||||||
|
Loading…
Reference in New Issue
Block a user