Use end of current month as end when not passed.

This commit is contained in:
Alexis Lahouze 2015-07-17 14:33:08 +02:00
parent edade3cda7
commit d9c1052f5e

View File

@ -54,6 +54,8 @@ class Operation(db.Model):
else: else:
account_id = account.id account_id = account.id
end = arrow.now().ceil('month').date() if not end else end
base_query = session.query( base_query = session.query(
cls, cls,
case( case(
@ -123,6 +125,8 @@ class Operation(db.Model):
else: else:
account_id = account.id account_id = account.id
end = end if end else arrow.now().ceil('month').date()
sold = func.sum(cls.value).over( sold = func.sum(cls.value).over(
order_by=[cls.operation_date, desc(cls.value), cls.label] order_by=[cls.operation_date, desc(cls.value), cls.label]
) )