Commit 22868eaf authored by Kristian Tan's avatar Kristian Tan

List all records

parent cc750257
...@@ -99,15 +99,9 @@ def main(): ...@@ -99,15 +99,9 @@ def main():
for pin in pins: for pin in pins:
pins[pin]['state'] = GPIO.input(pin) pins[pin]['state'] = GPIO.input(pin)
# Set the template data for the HTML template records = DailyUsage.query.all()
template_data = { for record in records:
'pins': pins, print(record)
'daily_total': daily_total,
'todays_cost': todays_cost,
'cost_per_kWh': os.environ['cost_per_kWh'],
'display_new_device_form': False,
'display_change_kWh': False
}
labels = [ labels = [
'JAN', 'FEB', 'MAR', 'APR', 'JAN', 'FEB', 'MAR', 'APR',
...@@ -121,6 +115,16 @@ def main(): ...@@ -121,6 +115,16 @@ def main():
4349.29, 6458.30, 9907, 16297 4349.29, 6458.30, 9907, 16297
] ]
# Set the template data for the HTML template
template_data = {
'pins': pins,
'daily_total': daily_total,
'todays_cost': todays_cost,
'cost_per_kWh': os.environ['cost_per_kWh'],
'display_new_device_form': False,
'display_change_kWh': False
}
return render_template('main.html', **template_data, labels=labels, values=values) return render_template('main.html', **template_data, labels=labels, values=values)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment