Summary
The function updateTEViewData() in OsemosysClass.py contains a logically impossible condition when both TechId and EmisId are provided.
The current implementation checks whether the same dictionary key k equals both TechId and EmisId simultaneously:
if ((k == TechId if TechId is not None else True) and
(k == EmisId if EmisId is not None else True)):
obj[k] = value
A single key cannot equal two different values at the same time. Therefore, when both TechId and EmisId are not None, the condition always evaluates to False.
As a result, the assignment:
obj[k] = value
is never executed and the data is silently not updated.
Expected behavior
The method should correctly update the nested JSON structure by handling TechId and EmisId as separate nested keys instead of comparing both against the same variable k.
The update should occur when the correct nested path is matched.
Reproduction steps
Open the file:
Navigate to the method:
updateTEViewData()
Locate the conditional logic around line ~950:
if ((k == TechId if TechId is not None else True) and
(k == EmisId if EmisId is not None else True)):
Call updateTEViewData() with both TechId and EmisId provided.
Example:
updateTEViewData(
casename="example_case",
ScId="Scenario1",
GroupId="GroupA",
ParamId="ParameterX",
TechId="Tech1",
EmisId="CO2",
value=100
)
Observe that the condition never becomes True, so the assignment inside the block is never executed.
Environment
OS: Windows 11
Python version: 3.10
Branch: main
Logs or screenshots
The issue occurs due to the unreachable condition inside updateTEViewData() where a single key is compared against both TechId and EmisId.
Related work checked
No existing issues or pull requests addressing this logical condition were found.
Proposed track
None
Summary
The function
updateTEViewData()inOsemosysClass.pycontains a logically impossible condition when bothTechIdandEmisIdare provided.The current implementation checks whether the same dictionary key
kequals bothTechIdandEmisIdsimultaneously:A single key cannot equal two different values at the same time. Therefore, when both
TechIdandEmisIdare notNone, the condition always evaluates toFalse.As a result, the assignment:
obj[k] = valueis never executed and the data is silently not updated.
Expected behavior
The method should correctly update the nested JSON structure by handling
TechIdandEmisIdas separate nested keys instead of comparing both against the same variablek.The update should occur when the correct nested path is matched.
Reproduction steps
Open the file:
Navigate to the method:
updateTEViewData()Locate the conditional logic around line ~950:
Call updateTEViewData() with both TechId and EmisId provided.
Example:
Observe that the condition never becomes True, so the assignment inside the block is never executed.
Environment
OS: Windows 11
Python version: 3.10
Branch: main
Logs or screenshots
The issue occurs due to the unreachable condition inside
updateTEViewData()where a single key is compared against bothTechIdandEmisId.Related work checked
No existing issues or pull requests addressing this logical condition were found.
Proposed track
None