Changed entry order to have positive values first in sum.

This commit is contained in:
Alexis Lahouze 2013-01-25 01:10:03 +01:00
parent c60462018e
commit 26cf3610fe
2 changed files with 3 additions and 3 deletions

View File

@ -27,8 +27,8 @@ def get_entries(account_id, year, month):
.order_by(
desc(Entry.value_date),
desc(Entry.operation_date),
Entry.value,
Entry.label,
Entry.value
).subquery()
).filter(func.date_trunc('month', Entry.value_date) == "%s-%s-01" % (year, month))

View File

@ -18,8 +18,8 @@ class Entry(db.Model):
account = db.relationship(Account, backref = db.backref('entry', lazy="Dynamic"))
category = db.Column(db.String(100), nullable = True)
sold = column_property(func.sum(value).over(order_by="value_date, operation_date, label desc, value desc"))
pointedsold = column_property(func.sum(value).over(partition_by="operation_date is not null", order_by="value_date, operation_date, label desc, value desc"))
sold = column_property(func.sum(value).over(order_by="value_date, operation_date, value desc, label desc"))
pointedsold = column_property(func.sum(value).over(partition_by="operation_date is not null", order_by="value_date, operation_date, value desc, label desc"))
def __init__(self, value_date, label, value, account_id, operation_date = None, category = None):
self.value_date = value_date