summaryrefslogtreecommitdiffstats
path: root/pages/machines.py
diff options
context:
space:
mode:
authorLukas Metzger2020-06-10 15:51:05 +0200
committerLukas Metzger2020-06-10 15:51:05 +0200
commitcd5b0fb700f531d3dc7b3313cf030ab0d8d60a7b (patch)
tree1d333ba854853a25b161cbe8d335267a65c829af /pages/machines.py
parentChanged default timeframe to 365 days (diff)
downloadbwlp-statistics-cd5b0fb700f531d3dc7b3313cf030ab0d8d60a7b.tar.gz
bwlp-statistics-cd5b0fb700f531d3dc7b3313cf030ab0d8d60a7b.tar.xz
bwlp-statistics-cd5b0fb700f531d3dc7b3313cf030ab0d8d60a7b.zip
Added minimal date for locations, machines and vms
Diffstat (limited to 'pages/machines.py')
-rw-r--r--pages/machines.py13
1 files changed, 13 insertions, 0 deletions
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']
+