Now select the current month if exists.
This commit is contained in:
@ -39,13 +39,13 @@ def get_months(account_id):
|
||||
session = db.session
|
||||
|
||||
query = session.query(
|
||||
distinct(extract("year", Entry.operation_date)).label("year"),
|
||||
extract("month", Entry.operation_date).label("month")
|
||||
distinct(cast(extract("year", Entry.operation_date), db.String)).label("year"),
|
||||
cast(extract("month", Entry.operation_date), db.String).label("month")
|
||||
).filter(Entry.account_id == account_id).order_by("year", "month")
|
||||
|
||||
return json.dumps([{
|
||||
"year": i.year,
|
||||
"month": i.month
|
||||
"month": i.month.rjust(2, '0')
|
||||
} for i in query.all()])
|
||||
|
||||
@app.route("/api/accounts", methods=["PUT"])
|
||||
|
Reference in New Issue
Block a user