Commit 546fb786 authored by Kristian Tan's avatar Kristian Tan

convert secodns to int

parent 1de7ca38
...@@ -77,8 +77,6 @@ def toggle_pin(change_pin): ...@@ -77,8 +77,6 @@ def toggle_pin(change_pin):
start_time = pins[change_pin]['on_time'] start_time = pins[change_pin]['on_time']
# Get the elapsed time and strip away milliseconds # Get the elapsed time and strip away milliseconds
elapsed = int((datetime.now() - start_time).total_seconds()) elapsed = int((datetime.now() - start_time).total_seconds())
print("SECS")
print(elapsed)
# Format the time # Format the time
start_date_string = datetime.strftime(start_time, '%Y-%m-%d') start_date_string = datetime.strftime(start_time, '%Y-%m-%d')
...@@ -93,6 +91,8 @@ def toggle_pin(change_pin): ...@@ -93,6 +91,8 @@ def toggle_pin(change_pin):
print(latest_entry.on_time_seconds) print(latest_entry.on_time_seconds)
else: else:
print("NEW ENTRY") print("NEW ENTRY")
print("SECS")
print(elapsed)
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)
......
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