Commit bc7fb396 authored by Kristian Tan's avatar Kristian Tan

Check if same day as most recent entry

parent cd5edaf7
...@@ -86,6 +86,9 @@ def toggle_pin(change_pin): ...@@ -86,6 +86,9 @@ def toggle_pin(change_pin):
# Create datetime object from formatted time # Create datetime object from formatted time
start_date = datetime.strptime(start_date_string, '%Y-%m-%d') start_date = datetime.strptime(start_date_string, '%Y-%m-%d')
if latest_entry.date == start_date:
print("SUCCESS")
entry = DailyUsage(date=start_date, on_time=elapsed) entry = DailyUsage(date=start_date, on_time=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