Skip to content

Commit

Permalink
dont change optimization status when selecting different override values
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelPesce committed Aug 3, 2023
1 parent d018b21 commit 5239424
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions electron/ui/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ useEffect(()=> {
navigate('/scenario', {replace: true})
}

const handleScenarioUpdate = (updatedScenario) => {
const handleScenarioUpdate = (updatedScenario, keepOptimized) => {
// console.log('inside handle scenario update')
if (updatedScenario.results.status==='Optimized') {
if (updatedScenario.results.status==='Optimized' && !keepOptimized) {
// console.log('changing status to not optimized')
updatedScenario.results.status = "Not Optimized"
}
Expand Down
4 changes: 2 additions & 2 deletions electron/ui/src/components/Bottombar/Bottombar.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ export default function Bottombar(props) {
// check if override values are present
try {
let tempHasOverride = false
if(props.scenario.results.status === "Not Optimized"){
// if(props.scenario.results.status === "Not Optimized"){
for (let key of Object.keys(props.scenario.override_values)) {
if(Object.keys(props.scenario.override_values[key]).length>0) tempHasOverride = true
}
// }
}

setHasOverride(tempHasOverride)
Expand Down
10 changes: 5 additions & 5 deletions electron/ui/src/components/OverrideTable/OverrideTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default function OverrideTable(props) {
}
const tempScenario = {...scenario}
tempScenario.override_values = tempOverrideValues
updateScenario(tempScenario)
updateScenario(tempScenario, true)
}

const handleInputOverrideValue = (event, number_value) => {
Expand Down Expand Up @@ -134,20 +134,20 @@ export default function OverrideTable(props) {
// else tempOverrideValues[category][idx].isZero = false
const tempScenario = {...scenario}
tempScenario.override_values = tempOverrideValues
updateScenario(tempScenario)
updateScenario(tempScenario, true)
}
else if(inputType === "technology") {
tempOverrideValues[category][idx].indexes[1] = val
const tempScenario = {...scenario}
tempScenario.override_values = tempOverrideValues
updateScenario(tempScenario)
updateScenario(tempScenario, true)
}
else if(!isNaN(val)) {
if (val === "") tempOverrideValues[category][idx].value = val
else tempOverrideValues[category][idx].value = parseInt(val)
const tempScenario = {...scenario}
tempScenario.override_values = tempOverrideValues
updateScenario(tempScenario)
updateScenario(tempScenario, true)
}
}

Expand All @@ -166,7 +166,7 @@ export default function OverrideTable(props) {
let tempScenario = {...scenario}
tempScenario.override_values = tempOverrideValues
tempScenario.results.data.vb_y_overview_dict=tempInfrastructureTable
updateScenario(tempScenario)
updateScenario(tempScenario, true)
}


Expand Down

0 comments on commit 5239424

Please sign in to comment.