diff options
-rw-r--r-- | pages/locations.py | 17 | ||||
-rw-r--r-- | pages/machines.py | 13 | ||||
-rw-r--r-- | pages/vms.py | 13 |
3 files changed, 42 insertions, 1 deletions
diff --git a/pages/locations.py b/pages/locations.py index 9cb36bc..85adcfc 100644 --- a/pages/locations.py +++ b/pages/locations.py @@ -33,6 +33,7 @@ def layout(): date=get_newest_date(), display_format='DD-MM-YYYY', max_date_allowed=get_newest_date(), + min_date_allowed=get_oldest_date(), initial_visible_month=get_newest_date(), first_day_of_week=1, persistence=True, @@ -44,7 +45,9 @@ def layout(): id='locations-satellite', options=[{'label': s, 'value': s} for s in get_satellites()], value=None, - placeholder='All Satellites' + placeholder='All Satellites', + persistence=True, + persistence_type='memory' ) ]) ]), @@ -224,3 +227,15 @@ def get_newest_date(): db.closeConnection(dbcon) return data[0]['date'] + +def get_oldest_date(): + dbcon = db.getConnection() + cursor = dbcon.cursor() + + cursor.execute("""SELECT date FROM reports ORDER BY date ASC LIMIT 1""") + + data = cursor.fetchall() + + db.closeConnection(dbcon) + return data[0]['date'] + diff --git a/pages/machines.py b/pages/machines.py index f314777..b82df43 100644 --- a/pages/machines.py +++ b/pages/machines.py @@ -33,6 +33,7 @@ def layout(): date=get_newest_date(), display_format='DD-MM-YYYY', max_date_allowed=get_newest_date(), + min_date_allowed=get_oldest_date(), initial_visible_month=get_newest_date(), first_day_of_week=1, persistence=True, @@ -291,3 +292,15 @@ def get_newest_date(): db.closeConnection(dbcon) return data[0]['date'] + +def get_oldest_date(): + dbcon = db.getConnection() + cursor = dbcon.cursor() + + cursor.execute("""SELECT date FROM reports ORDER BY date ASC LIMIT 1""") + + data = cursor.fetchall() + + db.closeConnection(dbcon) + return data[0]['date'] + diff --git a/pages/vms.py b/pages/vms.py index f0b9a05..c9ca141 100644 --- a/pages/vms.py +++ b/pages/vms.py @@ -33,6 +33,7 @@ def layout(): date=get_newest_date(), display_format='DD-MM-YYYY', max_date_allowed=get_newest_date(), + min_date_allowed=get_oldest_date(), initial_visible_month=get_newest_date(), first_day_of_week=1, persistence=True, @@ -143,3 +144,15 @@ def get_newest_date(): db.closeConnection(dbcon) return data[0]['date'] + +def get_oldest_date(): + dbcon = db.getConnection() + cursor = dbcon.cursor() + + cursor.execute("""SELECT date FROM reports ORDER BY date ASC LIMIT 1""") + + data = cursor.fetchall() + + db.closeConnection(dbcon) + return data[0]['date'] + |