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
8 stars 21 forks source link

Renaming activity parameters fails under certain conditions #65

Closed aleksandra-kim closed 4 years ago

aleksandra-kim commented 4 years ago

Original report by Daniël de Koning (Bitbucket: dgdekoning, GitHub: dgdekoning).


Found this while going through and manually trying everything in the activity browser.

Renaming fails when another activity parameter has the renamed activity parameter in its order, but only uses the parameter in ParameterizedExchanges (ie, exchange formulas).

Have already found a fix for the issue but need some time to add tests to cover all of the possible edge cases to determine if it is the right one.

aleksandra-kim commented 4 years ago

Original comment by Daniël de Koning (Bitbucket: dgdekoning, GitHub: dgdekoning).


Relevant methods are parameters.rename_activity_parameter and ActivityParameter.update_formula_activity_parameter_name.

Not enough groups are being selected/considered and ExchangeDataset formula field (only noticed this by chance) also needs to be updated with the new formula.

aleksandra-kim commented 4 years ago

Original comment by Daniël de Koning (Bitbucket: dgdekoning, GitHub: dgdekoning).


While working on this I found a different funny thing: The chain fixture contains an impossible(?) link between activity parameters as G (containing parameters for database K) has group A (containing parameters for database B) in its order. This causes an issue in the dependency_chain method for activity parameters as it specifically ignores parameters in other databases when attempting to find needed parameters.

aleksandra-kim commented 4 years ago

Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).


Fixed in PR #19