From 5c285c5e6c5596e60e6fe2a4c7ea4b3a42694b98 Mon Sep 17 00:00:00 2001 From: bill-becker Date: Fri, 1 Nov 2024 11:42:27 -0600 Subject: [PATCH] Fix updating CHP.installed_cost_per_kw if scalar --- reoptjl/src/process_results.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/reoptjl/src/process_results.py b/reoptjl/src/process_results.py index 87023850b..dd22d08e5 100644 --- a/reoptjl/src/process_results.py +++ b/reoptjl/src/process_results.py @@ -126,6 +126,8 @@ def update_inputs_in_database(inputs_to_update: dict, run_uuid: str) -> None: SiteInputs.objects.filter(meta__run_uuid=run_uuid).update(**inputs_to_update["Site"]) if inputs_to_update["CHP"]: # Will be an empty dictionary if CHP is not considered + if inputs_to_update["CHP"].get("installed_cost_per_kw") and type(inputs_to_update["CHP"].get("installed_cost_per_kw")) == float: + inputs_to_update["CHP"]["installed_cost_per_kw"] = [inputs_to_update["CHP"]["installed_cost_per_kw"]] CHPInputs.objects.filter(meta__run_uuid=run_uuid).update(**inputs_to_update["CHP"]) if inputs_to_update["SteamTurbine"]: # Will be an empty dictionary if SteamTurbine is not considered SteamTurbineInputs.objects.filter(meta__run_uuid=run_uuid).update(**inputs_to_update["SteamTurbine"])