From 0e5735a2adbe1dc22c9c1b16b729bbd7fdec25bd Mon Sep 17 00:00:00 2001 From: Aaron Wu <12989649+aaron-wu1@users.noreply.github.com> Date: Sun, 25 Feb 2024 11:26:49 -0800 Subject: [PATCH] reverted temp (#186) * reverted temp * lint backend --- backend/Dockerfile | 2 +- backend/api/config.py | 1 - backend/api/database/models/power_data.py | 9 ++------- backend/api/database/models/teros_data.py | 5 +---- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 2e215bdd..96248032 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -118,4 +118,4 @@ RUN chown -R app:app $APP_HOME # change to the app user USER app WORKDIR /home/app/ -ENTRYPOINT ["./backend/entrypoint.sh", "-d"] \ No newline at end of file +ENTRYPOINT ["./backend/entrypoint.sh", "-p"] \ No newline at end of file diff --git a/backend/api/config.py b/backend/api/config.py index e24fb07b..3a9060d4 100644 --- a/backend/api/config.py +++ b/backend/api/config.py @@ -17,7 +17,6 @@ class Config(object): SQLALCHEMY_DATABASE_URI = dburl SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_ENGINE_OPTIONS = {"pool_pre_ping": True} - SQLALCHEMY_ECHO = True GOOGLE_CLIENT_ID = os.getenv("GOOGLE_CLIENT_ID") GOOGLE_CLIENT_SECRET = os.getenv("GOOGLE_CLIENT_SECRET") REDIRECT_URI = os.getenv("OAUTH_REDIRECT_URI") diff --git a/backend/api/database/models/power_data.py b/backend/api/database/models/power_data.py index 53304ef3..5eabd17b 100644 --- a/backend/api/database/models/power_data.py +++ b/backend/api/database/models/power_data.py @@ -1,7 +1,7 @@ from ..models import db from .cell import Cell from .logger import Logger -from datetime import datetime, timezone, timedelta +from datetime import datetime from dateutil.relativedelta import relativedelta @@ -78,7 +78,7 @@ def get_power_data_obj( "i": [], "p": [], } - print(f"start time: {start_time}, end time: {end_time}", flush=True) + stmt = ( db.select( PowerData.ts_server.label("ts"), @@ -98,11 +98,6 @@ def get_power_data_obj( (stmt.c.voltage * stmt.c.current * 1e-6).label("power"), ).order_by(stmt.c.ts) - utc_tz = timezone.utc - la_tz = timezone(timedelta(hours=0)) - res = db.session.execute(adj_units) - print(f"timestamps: {[r.ts for r in res]}", flush=True) - for row in db.session.execute(adj_units): data["timestamp"].append(row.ts) data["v"].append(row.voltage) diff --git a/backend/api/database/models/teros_data.py b/backend/api/database/models/teros_data.py index 03058135..21522f13 100644 --- a/backend/api/database/models/teros_data.py +++ b/backend/api/database/models/teros_data.py @@ -1,7 +1,7 @@ from ..models import db from sqlalchemy.sql import func from .cell import Cell -from datetime import datetime, timezone, timedelta +from datetime import datetime from dateutil.relativedelta import relativedelta @@ -86,9 +86,6 @@ def get_teros_data_obj( .order_by(TEROSData.ts_server) ) - utc_tz = timezone.utc - la_tz = timezone(timedelta(hours=0)) - for row in db.session.execute(stmt): data["timestamp"].append(row.ts) data["vwc"].append(row.vwc)