fix rbd project name

main
Cizz22 6 months ago
parent e9bd6b3dc9
commit 8b1474f68f

@ -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)

@ -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):

@ -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,

Loading…
Cancel
Save