Commit 3736be77 authored by Kristian Tan's avatar Kristian Tan

Order chart by date

parent fe057870
from flask import Flask, render_template, request
import RPi.GPIO as GPIO
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import desc
from sqlalchemy import asc
import os
from datetime import datetime, date, timedelta
# from daily_usage import DailyUsage
......@@ -103,7 +103,7 @@ def main():
values = []
max = 0
records = DailyUsage.query.order_by(desc(DailyUsage.date)).all()
records = DailyUsage.query.order_by(asc(DailyUsage.date)).all()
for record in records:
labels.append(date(record.date.year, record.date.month, record.date.day))
values.append(record.kwhUsed)
......
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