From 2967cd81003bf44b900460c0329b058beb25645b Mon Sep 17 00:00:00 2001
From: thdfw
Date: Fri, 20 Dec 2024 23:27:33 +0100
Subject: [PATCH] Adding Dijkstra download
---
analysis.py | 3 +++
index.html | 7 ++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/analysis.py b/analysis.py
index 34f9565..fa76382 100644
--- a/analysis.py
+++ b/analysis.py
@@ -6,6 +6,7 @@
from sqlalchemy.orm import sessionmaker
from fake_config import Settings
from fake_models import MessageSql
+import os
def download_excel(house_alias, start_ms):
settings = Settings(_env_file=dotenv.find_dotenv())
@@ -32,6 +33,8 @@ def download_excel(house_alias, start_ms):
# for key, value in flo_params_msg.payload.items():
# print(f'{key}: {value}')
+ os.remove('result.xlsx')
+
print("Running Dijkstra and saving analysis to excel...")
g = DGraph(flo_params)
g.solve_dijkstra()
diff --git a/index.html b/index.html
index 0dc091c..b3a49cc 100644
--- a/index.html
+++ b/index.html
@@ -23,7 +23,8 @@
const endUnixMilliseconds = endtime_luxon.toUTC().toMillis();
try {
- const response = await fetch('http://localhost:8000/download_excel', {
+ const response = await fetch(`https://visualizer.electricity.works/download_excel`, {
+ // const response = await fetch('http://localhost:8000/download_excel', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@@ -151,8 +152,8 @@
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
try {
- //const response = await fetch(`https://visualizer.electricity.works/plots`, {
- const response = await fetch(`http://localhost:8000/plots`, {
+ const response = await fetch(`https://visualizer.electricity.works/plots`, {
+ // const response = await fetch(`http://localhost:8000/plots`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'