Commit 49112e30 authored by Kristian Tan's avatar Kristian Tan

Fix not tracking usage

parent e20e3e29
...@@ -37,8 +37,8 @@ class DailyUsage(db.Model): ...@@ -37,8 +37,8 @@ class DailyUsage(db.Model):
def get_todays_usage(): def get_todays_usage():
records = DailyUsage.query.order_by(asc(DailyUsage.date)).all() records = DailyUsage.query.order_by(asc(DailyUsage.date)).all()
latest_entry = DailyUsage.query.order_by(asc(DailyUsage.date)).first() latest_entry = DailyUsage.query.order_by(asc(DailyUsage.date)).last()
print(records) print(latest_entry)
# latest_entry = db.session.query(DailyUsage).order_by(DailyUsage.date.asc()).first() # latest_entry = db.session.query(DailyUsage).order_by(DailyUsage.date.asc()).first()
if latest_entry: if latest_entry:
latest_entry_date = date(latest_entry.date.year, latest_entry.date.month, latest_entry.date.day) latest_entry_date = date(latest_entry.date.year, latest_entry.date.month, latest_entry.date.day)
......
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