diff --git a/src/api/controller/entries.py b/src/api/controller/entries.py index 5bda88f..eec3059 100644 --- a/src/api/controller/entries.py +++ b/src/api/controller/entries.py @@ -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)) diff --git a/src/api/model/entries.py b/src/api/model/entries.py index d23e507..9a376c9 100644 --- a/src/api/model/entries.py +++ b/src/api/model/entries.py @@ -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