Fix crash: rename shadowing 'pot' variable in forecast closure
In estimate()'s on_step_changed closure, the new 'pot = step.get("pot", {})'
local variable shadowed the outer 'pot' (Pot plant instance), causing
pot.set_plant_params() to be called on a plain dict and crash on load.
Renamed to 'step_pot' to avoid the collision.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T52JH848ojhXXHn1bAzdC3
This commit is contained in:
@@ -156,8 +156,8 @@ class SudForecastEstimator:
|
||||
# re-assigns self.step to retrigger it) - only the *first* call
|
||||
# for a given index is its actual start.
|
||||
step_starts.setdefault(sud.index, t[-1])
|
||||
pot = step.get('pot', {})
|
||||
params = sud.derive_plant_params(pot.get('grain_mass', 0), pot.get('water_mass', 0))
|
||||
step_pot = step.get('pot', {})
|
||||
params = sud.derive_plant_params(step_pot.get('grain_mass', 0), step_pot.get('water_mass', 0))
|
||||
pot.set_plant_params(params)
|
||||
tc.set_model_plant_params(params)
|
||||
if sud.state == SudState.RAMPING and step['temperature'] is not None:
|
||||
|
||||
Reference in New Issue
Block a user