Skip to content

Commit

Permalink
Fix list slicing in db and styling of index page.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankit Rajpoot committed Nov 1, 2018
1 parent ec18a7d commit 43e086d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 10 deletions.
6 changes: 3 additions & 3 deletions db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
33 changes: 31 additions & 2 deletions static/styles.css
Original file line number Diff line number Diff line change
@@ -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;
}
11 changes: 6 additions & 5 deletions webtemplates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>WaterPI - WaterPI loves plants!</title>
<title>GardenPI - GardenPI loves plants!</title>
<link rel="stylesheet" href="static/styles.css" type="text/css" />

<script src="https://cdn.jsdelivr.net/npm/ractive"></script>
Expand Down Expand Up @@ -75,7 +75,7 @@
</script>
</head>
<body>
<h1>WaterPI - WaterPI loves plants!</h1>
<h1>GardenPI - GardenPI loves plants!</h1>

<strong><em>
<p>
Expand All @@ -86,15 +86,17 @@ <h1>WaterPI - WaterPI loves plants!</h1>
They feel alone and hungry.
</p>
<p>
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.
</p>
</em></strong>
<br /><br /><br />
<br /><br />
<h3>System Status</h3>
<p>Temperature: <span style="color: orange; font-weight: bold">$temp</span></p>
<br /><br />

<button onclick="window.open('/operation/runpump')">Run Pump Now</button>
<br />
<button onclick="startFeed()">Start Live Feed</button>
<h3>Recent Pump Logs (Auto-updates every 30secs)</h3>
<div id="pump-logs-div">

Expand All @@ -113,7 +115,6 @@ <h3>Recent Charge Logs (Auto-updates every 10 minutes)</h3>
</div>

<br /><br />
<button onclick="startFeed()">Start Live Feed</button>
<div id="live-feed">

</div>
Expand Down

0 comments on commit 43e086d

Please sign in to comment.