From 8b1474f68f389282bc6d194a7d933d3cc4dbc9f9 Mon Sep 17 00:00:00 2001 From: Cizz22 Date: Wed, 16 Jul 2025 14:24:22 +0700 Subject: [PATCH] fix rbd project name --- src/aeros_equipment/service.py | 2 +- src/aeros_project/service.py | 7 ++++--- src/aeros_simulation/service.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/aeros_equipment/service.py b/src/aeros_equipment/service.py index 8229320..3b2f1d3 100644 --- a/src/aeros_equipment/service.py +++ b/src/aeros_equipment/service.py @@ -127,7 +127,7 @@ async def save_default_equipment(*, db_session: DbSession, project_name: str): reg_nodes = [node.location_tag for node in equipment_nodes.scalars().all()] - updateNodeReq = {"projectName": DEFAULT_PROJECT_NAME, "equipmentNames": reg_nodes} + updateNodeReq = {"projectName": project_name, "equipmentNames": reg_nodes} # Delete old data query = Delete(AerosEquipment) diff --git a/src/aeros_project/service.py b/src/aeros_project/service.py index 25e4dc2..f5c9cea 100644 --- a/src/aeros_project/service.py +++ b/src/aeros_project/service.py @@ -64,7 +64,7 @@ async def import_aro_project(*, db_session: DbSession, aeros_project_in: AerosPr # Prepare file for upload files = { - "file": (file.filename, content, file.content_type or "application/octet-stream") + "file": (file.filename.replace(" ", "_"), content, file.content_type or "application/octet-stream") } response = await client.post( @@ -76,6 +76,7 @@ async def import_aro_project(*, db_session: DbSession, aeros_project_in: AerosPr # Get the file path from the response upload_result = response.json() aro_path = upload_result.get("full_path") + filename = upload_result.get("stored_filename").replace(".aro", "") if not aro_path: raise HTTPException( @@ -97,7 +98,7 @@ async def import_aro_project(*, db_session: DbSession, aeros_project_in: AerosPr # aro_path = r"C:/Users/user/Documents/Aeros/sample_project.aro" - aeros_project = AerosProject(project_name=project_name, aro_file_path=aro_path) + aeros_project = AerosProject(project_name=filename, aro_file_path=aro_path) # find aeros record first, if not found, then create a new one stmt = select(AerosProject).order_by(desc(AerosProject.created_at)).limit(1) @@ -129,7 +130,7 @@ async def import_aro_project(*, db_session: DbSession, aeros_project_in: AerosPr await _initialize_default_project_data( db_session=db_session, - project_name=project_name + project_name=filename ) async def fetch_aro_record(*, db_session: DbSession): diff --git a/src/aeros_simulation/service.py b/src/aeros_simulation/service.py index 9479c67..3f503d6 100644 --- a/src/aeros_simulation/service.py +++ b/src/aeros_simulation/service.py @@ -259,7 +259,7 @@ async def save_default_simulation_node( *, db_session: DbSession, project_name: str = "trialapi" ): sim_data = { - "projectName": DEFAULT_PROJECT_NAME, + "projectName": project_name, "SchematicName": "Boiler", "SimSeed": 1, "SimDuration": 3,