Commit 3e0c2d54 authored by Kristian Tan's avatar Kristian Tan

Displaying daily total on html

parent e203d2df
...@@ -87,13 +87,14 @@ def toggle_pin(change_pin): ...@@ -87,13 +87,14 @@ def toggle_pin(change_pin):
start_date = pins[change_pin]['on_date'] start_date = pins[change_pin]['on_date']
# If there is already an entry for today, update on time # If there is already an entry for today, update on time
if latest_entry: # if latest_entry:
print(latest_entry.date) # print(latest_entry.date)
print(start_date) # print(start_date)
if latest_entry and latest_entry.date == start_date: if latest_entry and latest_entry.date == start_date:
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
print(start_date)
entry = DailyUsage(date=start_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()
......
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