Commit 81ccd0e4 authored by Kristian Tan's avatar Kristian Tan

Fix not tracking usage

parent 49112e30
from flask import Flask, render_template, request
import RPi.GPIO as GPIO
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import asc
from sqlalchemy import asc, desc
import os
from datetime import datetime, date, timedelta
# from daily_usage import DailyUsage
......@@ -37,7 +37,7 @@ class DailyUsage(db.Model):
def get_todays_usage():
records = DailyUsage.query.order_by(asc(DailyUsage.date)).all()
latest_entry = DailyUsage.query.order_by(asc(DailyUsage.date)).last()
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()
if latest_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