Commit 8b089978 authored by Kristian Tan's avatar Kristian Tan

Fix not tracking usage

parent 81ccd0e4
......@@ -36,7 +36,6 @@ class DailyUsage(db.Model):
def get_todays_usage():
records = DailyUsage.query.order_by(asc(DailyUsage.date)).all()
latest_entry = DailyUsage.query.order_by(desc(DailyUsage.date)).first()
print(latest_entry)
# latest_entry = db.session.query(DailyUsage).order_by(DailyUsage.date.asc()).first()
......@@ -52,7 +51,7 @@ def get_todays_cost():
def create_entry(change_pin):
latest_entry = db.session.query(DailyUsage).order_by(DailyUsage.id.desc()).first()
latest_entry = DailyUsage.query.order_by(desc(DailyUsage.date)).first()
start_time = pins[change_pin]['on_time']
# Get the elapsed time and strip away milliseconds
elapsed = int((datetime.now() - start_time).total_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