From 81307fb1df53129179e7454dd5c4f15587ab67a3 Mon Sep 17 00:00:00 2001 From: MichaelPesce Date: Tue, 11 Jul 2023 13:42:16 -0500 Subject: [PATCH] added corresponding output tables for infrastructure buildout variables --- .../components/OverrideTable/OverrideTable.js | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/electron/ui/src/components/OverrideTable/OverrideTable.js b/electron/ui/src/components/OverrideTable/OverrideTable.js index 58453c2d..2d406a58 100644 --- a/electron/ui/src/components/OverrideTable/OverrideTable.js +++ b/electron/ui/src/components/OverrideTable/OverrideTable.js @@ -5,11 +5,22 @@ import ParetoDictionary from '../../assets/ParetoDictionary.json' import CategoryNames from '../../assets/CategoryNames.json' const OVERRIDE_PRESET_VALUES = { - "Pipeline Construction": "PipelineDiameterValues", - "Storage Facility": "StorageCapacityIncrements", - "Disposal Facility": "DisposalCapacityIncrements", - "Treatment Facility": "TreatmentCapacityIncrements", - + "Pipeline Construction": { + input_table: "PipelineDiameterValues", + variable_name: "vb_y_Pipeline_dict" + }, + "Storage Facility": { + input_table: "StorageCapacityIncrements", + variable_name: "vb_y_Storage_dict" + }, + "Disposal Facility": { + input_table: "DisposalCapacityIncrements", + variable_name: "vb_y_Disposal_dict" + }, + "Treatment Facility": { + input_table: "TreatmentCapacityIncrements", + variable_name: "vb_y_Treatment_dict" + }, } export default function OverrideTable(props) { @@ -83,10 +94,10 @@ export default function OverrideTable(props) { if(value[0] === "Treatment Facility") { let technology = value[5] let technologyNamesKey = "TreatmentCapacities" - let indexOfTechnology = scenario.data_input.df_parameters[OVERRIDE_PRESET_VALUES[value[0]]][technologyNamesKey].indexOf(technology) + let indexOfTechnology = scenario.data_input.df_parameters[OVERRIDE_PRESET_VALUES[value[0]].input_table][technologyNamesKey].indexOf(technology) // let presetValues = [] - for (let each of Object.keys(scenario.data_input.df_parameters[OVERRIDE_PRESET_VALUES[value[0]]])) { - let val = scenario.data_input.df_parameters[OVERRIDE_PRESET_VALUES[value[0]]][each][indexOfTechnology] + for (let each of Object.keys(scenario.data_input.df_parameters[OVERRIDE_PRESET_VALUES[value[0]].input_table])) { + let val = scenario.data_input.df_parameters[OVERRIDE_PRESET_VALUES[value[0]].input_table][each][indexOfTechnology] if(val !== technology) { presetValues.push(val) } @@ -94,7 +105,7 @@ export default function OverrideTable(props) { } return ( @@ -117,7 +128,7 @@ export default function OverrideTable(props) { )) : - scenario.data_input.df_parameters[OVERRIDE_PRESET_VALUES[value[0]]].VALUE.map((presetValue, i) => ( + scenario.data_input.df_parameters[OVERRIDE_PRESET_VALUES[value[0]].input_table].VALUE.map((presetValue, i) => ( {presetValue}