Commit d3f4bdc3 authored by Kristian Tan's avatar Kristian Tan

Displaying daily total on html

parent 66ec4526
...@@ -94,7 +94,7 @@ def toggle_pin(change_pin): ...@@ -94,7 +94,7 @@ def toggle_pin(change_pin):
latest_entry.on_time_seconds += elapsed latest_entry.on_time_seconds += elapsed
else: else:
# If no entry for today, make one # If no entry for today, make one
entry = DailyUsage(date=start_date.date(), on_time_seconds=elapsed) entry = DailyUsage(date=start_date, on_time_seconds=elapsed)
db.session.add(entry) db.session.add(entry)
db.session.commit() db.session.commit()
pins[change_pin]['on_time'] = None pins[change_pin]['on_time'] = None
...@@ -102,7 +102,7 @@ def toggle_pin(change_pin): ...@@ -102,7 +102,7 @@ def toggle_pin(change_pin):
else: else:
message += " on." message += " on."
pins[change_pin]['on_time'] = datetime.now() pins[change_pin]['on_time'] = datetime.now()
pins[change_pin]['on_date'] = datetime.now().date() pins[change_pin]['on_date'] = datetime.date.today()
for pin in pins: for pin in pins:
pins[pin]['state'] = GPIO.input(pin) pins[pin]['state'] = GPIO.input(pin)
......
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