fixing API to return current conditions
This commit is contained in:
@@ -10,12 +10,8 @@ bp = Blueprint('api', __name__)
|
|||||||
@bp.route('/api')
|
@bp.route('/api')
|
||||||
def api():
|
def api():
|
||||||
db = get_db()
|
db = get_db()
|
||||||
latest_period = dict(db.execute(
|
|
||||||
'SELECT `id` FROM `reports` WHERE `type` = "hourly" ORDER BY `reported_at` DESC'
|
|
||||||
).fetchone())
|
|
||||||
|
|
||||||
current_conditions = dict(db.execute(
|
current_conditions = dict(db.execute(
|
||||||
f"SELECT * FROM `periods` WHERE `report_id` = {latest_period['id']} LIMIT 1"
|
"SELECT * FROM `current_forecasts` ORDER BY `end_time` DESC LIMIT 1"
|
||||||
).fetchone())
|
).fetchone())
|
||||||
|
|
||||||
return current_conditions
|
return current_conditions
|
||||||
|
|||||||
Reference in New Issue
Block a user