From 43e086d3cd789b1126fee62e4d12c4c43c5656bf Mon Sep 17 00:00:00 2001
From: Ankit Rajpoot
Date: Thu, 1 Nov 2018 19:13:56 +0530
Subject: [PATCH] Fix list slicing in db and styling of index page.
---
db.py | 6 +++---
static/styles.css | 33 +++++++++++++++++++++++++++++++--
webtemplates/index.html | 11 ++++++-----
3 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/db.py b/db.py
index 97ed5d2..c698ac0 100644
--- a/db.py
+++ b/db.py
@@ -38,20 +38,20 @@ def logChargeRun(entry):
def getRecentPumpRuns():
logs = pumpDB.all()
if (len(logs) > 25):
- return logs[-25]
+ return logs[-25:]
else:
return logs
def getRecentFanRuns():
logs = fanDB.all()
if (len(logs) > 25):
- return logs[-25]
+ return logs[-25:]
else:
return logs
def getRecentChargeRuns():
logs = chargeDB.all()
if (len(logs) > 25):
- return logs[-25]
+ return logs[-25:]
else:
return logs
diff --git a/static/styles.css b/static/styles.css
index 54d8739..d2c5bd1 100644
--- a/static/styles.css
+++ b/static/styles.css
@@ -1,3 +1,32 @@
-.logs-table {
- border: 1px solid red;
+html {
+ font-size: 1em;
+}
+
+table {
+ font-size:16px;
+ font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
+ border-collapse: collapse;
+ border-spacing: 0;
+ width: 100%;
+}
+
+table th {
+ padding-top: 11px;
+ padding-bottom: 11px;
+ background-color: #4CAF50;
+ color: white;
+}
+
+table td, table th {
+ border: 1px solid #ddd;
+ text-align: left;
+ padding: 8px;
+}
+
+table tr:nth-child(even){background-color: #f2f2f2}
+
+button {
+ width: 100%;
+ height: 40px;
+ margin-bottom: 20px;
}
diff --git a/webtemplates/index.html b/webtemplates/index.html
index 80a31ec..26f8d0e 100644
--- a/webtemplates/index.html
+++ b/webtemplates/index.html
@@ -4,7 +4,7 @@
- WaterPI - WaterPI loves plants!
+ GardenPI - GardenPI loves plants!
@@ -75,7 +75,7 @@
- WaterPI - WaterPI loves plants!
+ GardenPI - GardenPI loves plants!
@@ -86,15 +86,17 @@
WaterPI - WaterPI loves plants!
They feel alone and hungry.
- Thankfully, WaterPI is here, to take care of your plant friends when you're out.
+ Thankfully, GardenPI is here, to take care of your plant friends when you're out.
-
+
System Status
Temperature: $temp
Run Pump Now
+
+ Start Live Feed
Recent Pump Logs (Auto-updates every 30secs)
@@ -113,7 +115,6 @@
Recent Charge Logs (Auto-updates every 10 minutes)
- Start Live Feed