Cleanup old functions.

This commit is contained in:
Alexis Lahouze 2017-05-25 21:22:00 +02:00
parent b436e0aa06
commit d9e9e3f2a0
2 changed files with 2 additions and 10 deletions

View File

@ -27,10 +27,6 @@ class Account(db.Model):
cls.name cls.name
) )
def solds(self):
"""Return the balances of this account."""
return self.balances()
def balances(self): def balances(self):
"""Return the balances of this account.""" """Return the balances of this account."""
return db.session.query( return db.session.query(
@ -53,10 +49,6 @@ class Account(db.Model):
Operation.account_id == self.id Operation.account_id == self.id
).one() ).one()
def balance(self, begin, end):
"""Return the flow for a specific time period."""
return self.flow(begin, end)
def flow(self, begin, end): def flow(self, begin, end):
"""Return the flow for a specific time period.""" """Return the flow for a specific time period."""
query = db.session.query( query = db.session.query(

View File

@ -264,7 +264,7 @@ class SoldsResource(Resource):
# Note: if we don't pass the code, the result is seen as a tuple and # Note: if we don't pass the code, the result is seen as a tuple and
# causes error on marshalling. # causes error on marshalling.
return account.solds(), 200 return account.balances(), 200
@ns.route('/<int:account_id>/balance') @ns.route('/<int:account_id>/balance')
@ -296,7 +296,7 @@ class BalanceResource(Resource):
# Note: if we don't pass the code, the result is seen as a tuple and # Note: if we don't pass the code, the result is seen as a tuple and
# causes error on marshalling. # causes error on marshalling.
return account.balance(**data), 200 return account.flow(**data), 200
@ns.route("/<int:account_id>/category") @ns.route("/<int:account_id>/category")