Commits

Robert Brewer  committed d7b60a7

Colored past-due flows red, and fixed a couple buglets

  • Participants
  • Parent commits 5cb199b

Comments (0)

Files changed (3)

File flowrate/__init__.py

         vals = req.json["body"]
         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",
             (vals["amount"],
              popint(vals["credit"]),
              popint(vals["debit"]),
         # Determine the full range of buckets; even if our ledger has no
         # transactions within a given bucket, we still want to output it.
         if not years:
-            years = seen_years
+            years = [row.year for row in db.execute(
+                "SELECT DISTINCT EXTRACT(year FROM postdate) AS year "
+                "FROM transactions;").fetchall()]
+            if not years:
+                years = [datetime.date.today().year]
         if not months:
             months = range(1, 13)
 

File flowrate/testing/config.py

 
 db_info = {
     "host": "localhost",
-    "database": "flowrate",
+    "database": "flowrate_fu",
     "user": "postgres",
     "password": "",
     "port": 5434,

File flowrate/transactions.html

     return tx.postdate.substring(0, 7);
 }
 
+function date_from_iso(d) {
+    var y = parseInt(d.substring(0, 4));
+    var m = parseInt(d.substring(5, 7)) - 1;
+    var d = parseInt(d.substring(8, 10));
+    return new Date(y, m , d)
+}
+
 txs = {};
 
 function add_tx_row(tx, already_sorted) {
         r.onclick = function () { edit_transaction(txid) };
     } else {
         r.className = 'flowrow';
+        if (date_from_iso(tx.postdate) < new Date()) {
+            r.style.backgroundColor = '#FFEEEE';
+        }
     }
 
     add_tx_cells_fast(r, txid, tx);