From 2a213ea3281dd03f55bf98839f5e2d08c7602ffb Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Wed, 25 Feb 2015 23:40:20 -0800 Subject: [PATCH] Display of data age in update command --- commands/update_cmd.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/commands/update_cmd.py b/commands/update_cmd.py index b526cf0a..fc6b51a9 100644 --- a/commands/update_cmd.py +++ b/commands/update_cmd.py @@ -353,6 +353,19 @@ def guidedUpdate(tdb, cmdenv): stationID = cmdenv.startStation.ID tmpPath = getTemporaryPath(cmdenv) + cur = tdb.query(""" + SELECT JULIANDAY('now') - JULIANDAY(MIN(modified)), + JULIANDAY('now') - JULIANDAY(MAX(modified)) + FROM StationItem + WHERE station_id = ? + """, [stationID]) + oldest, newest = cur.fetchone() + if oldest and newest: + cmdenv.NOTE( + "Current data {:.2f}-{:.2f} days old.", + oldest, newest, + ) + from commands.update_gui import render try: render(tdb, cmdenv, tmpPath)