Commit 673aa969 authored by Kristian Tan's avatar Kristian Tan

move class?

parent 26ab7678
...@@ -17,8 +17,6 @@ GPIO.setmode(GPIO.BCM) ...@@ -17,8 +17,6 @@ GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False) GPIO.setwarnings(False)
db = SQLAlchemy(app) db = SQLAlchemy(app)
os.environ['cost_per_kWh'] = '0.1622'
# TODO: Move this into daily_usage class file # TODO: Move this into daily_usage class file
class DailyUsage(db.Model): class DailyUsage(db.Model):
...@@ -36,6 +34,9 @@ class DailyUsage(db.Model): ...@@ -36,6 +34,9 @@ class DailyUsage(db.Model):
return '<DailyUsage %r, %r, %r>' % (self.id, self.date, self.kwhUsed) return '<DailyUsage %r, %r, %r>' % (self.id, self.date, self.kwhUsed)
os.environ['cost_per_kWh'] = '0.1622'
def get_todays_usage(): def get_todays_usage():
latest_entry = DailyUsage.query.order_by(desc(DailyUsage.date)).first() latest_entry = DailyUsage.query.order_by(desc(DailyUsage.date)).first()
# latest_entry = db.session.query(DailyUsage).order_by(DailyUsage.date.asc()).first() # latest_entry = db.session.query(DailyUsage).order_by(DailyUsage.date.asc()).first()
......
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