Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with updateSupplyFacilitiesFinances #117

Open
toddmedema opened this issue Apr 30, 2024 · 0 comments
Open

Bug with updateSupplyFacilitiesFinances #117

toddmedema opened this issue Apr 30, 2024 · 0 comments

Comments

@toddmedema
Copy link
Owner

toddmedema commented Apr 30, 2024

Now that we can pause/resume facilities (#116), there's a noticeable bug where, if you pause and de-ramp to 0 a slow-ramping facility (e.g. nuclear), and then resume it, the forecast correctly shows it ramping back up - but in the actual now moment, it's magically ramped back up to full capacity!

I'm not sure why it's different between the forecast and the now moment, since I thought they both use the same updateSupply function... at the very least, this is a good excuse to modularize and unit test this function to make sure it's not an issue with, say, the min/max math

EDIT: Current suspect is the fact that it's editing the facilities in place when forecasting? But that doesn't really make sense, it looks like the forecast view calls generateNewTimeline, which deepClones the state...

Ohhh, togglePauseFacility and sellFacility do state.timeline = reforecastSupply(state);, skipping the deepClone in generateNewTimeline...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant