Improve filtering on date.
This commit is contained in:
parent
d960ac0852
commit
ba665923f6
@ -158,15 +158,18 @@ class Operation(db.Model):
|
|||||||
db.func.sum(cls.value).label("balance")
|
db.func.sum(cls.value).label("balance")
|
||||||
).filter(
|
).filter(
|
||||||
cls.account_id == account_id
|
cls.account_id == account_id
|
||||||
).filter(
|
|
||||||
cls.operation_date >= str(begin),
|
|
||||||
cls.operation_date <= str(end)
|
|
||||||
).order_by(
|
).order_by(
|
||||||
cls.category
|
cls.category
|
||||||
).group_by(
|
).group_by(
|
||||||
cls.category
|
cls.category
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if begin:
|
||||||
|
query = query.filter(cls.operation_date >= str(begin))
|
||||||
|
|
||||||
|
if end:
|
||||||
|
query = query.filter(cls.operation_date <= str(end))
|
||||||
|
|
||||||
return query
|
return query
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user