newrow = db.execute("INSERT INTO transactions"
" (amount, credit_account, debit_account, postdate) "
- "VALUES (%s, %s, %s,
%s, %s, %s) RETURNING id",
+ "VALUES (%s, %s, %s, %s) RETURNING id",
# Determine the full range of buckets; even if our ledger has no
# transactions within a given bucket, we still want to output it.
+ years = [row.year for row in db.execute(
+ "SELECT DISTINCT EXTRACT(year FROM postdate) AS year "
+ "FROM transactions;").fetchall()]
+ years = [datetime.date.today().year]