Commit 151073df authored by Kristian Tan's avatar Kristian Tan

Renamed class

parent 54c1174e
......@@ -100,7 +100,7 @@ db.create_all()
daily_total = get_todays_usage()
todays_cost = get_todays_cost()
print(get_todays_usage())
print(daily_usage.DailyUsage.get_todays_usage())
print(daily_usage.DailyUsageService.get_todays_usage())
print(get_todays_cost())
# Create dictionary to store pin info
......
from datetime import datetime, date
from sqlalchemy import desc
import app
from app import DailyUsage
class DailyUsageService:
......@@ -11,7 +12,7 @@ class DailyUsageService:
@staticmethod
def get_todays_usage():
latest_entry = app.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()
if latest_entry:
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