Commit 49e359c9 authored by Kristian Tan's avatar Kristian Tan

Displaying daily total on html

parent c305196f
...@@ -38,8 +38,9 @@ db.create_all() ...@@ -38,8 +38,9 @@ db.create_all()
# TODO: be able to query db by date # TODO: be able to query db by date
daily_total = 0 daily_total = 0
latest_entry = db.session.query(DailyUsage).order_by(DailyUsage.id.desc()).first() latest_entry = db.session.query(DailyUsage).order_by(DailyUsage.id.desc()).first()
latest_entry_date = date(latest_entry.date.year, latest_entry.date.month, latest_entry.date.day) if latest_entry:
if latest_entry and latest_entry_date == datetime.today().date(): latest_entry_date = date(latest_entry.date.year, latest_entry.date.month, latest_entry.date.day)
if latest_entry_date == datetime.today().date():
daily_total += latest_entry.on_time_seconds daily_total += latest_entry.on_time_seconds
......
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