brightway-lca / brightway2-data

Tools for the management of inventory databases and impact assessment methods. Part of the Brightway LCA framework.
https://docs.brightway.dev/
BSD 3-Clause "New" or "Revised" License
11 stars 24 forks source link

`calculation_setups` doesn't sync on object modification or deletion #191

Open marc-vdm opened 2 months ago

marc-vdm commented 2 months ago

When removing an activity or database, any calculations setups are not updated and may end up containing references to activities that do not exist anymore. This leads to errors when trying to perform a calculation.

I suggest BW checks calculation setups on deletion of activity/database and removes any matching keys from calculation setups.

cmutel commented 1 month ago

Having to iterate over all calculation_setups is not great, but pushing this data to the database needs bigger changes to land first, so we have to...

marc-vdm commented 1 month ago

I agree that this is not ideal, but IMO this should be normal BW functionality.

Note that I forgot that this is the same for impact categories upon their deletion.

And while we're at it, does bw check: