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

FIX dict initialization in get_gkwh_shares_dict #98

Merged
merged 1 commit into from
Mar 29, 2022

Conversation

MarJene
Copy link
Contributor

@MarJene MarJene commented Mar 28, 2022

In Python, using:
{}.fromkeys(key_names, []) sets the SAME object list for every element in the dictionary.

Meaning:

a_dict = {}.fromkeys(['a','b'], []) 
a_dict['a'].append(0)

results in:

a_dict = {'a':[0], 'b':[0]}

As a result, when an out_refund invoice is unlinked, the sum of all gkwh rights in the invoice was marked as used for each gkwh period in the invoice.

@MarJene MarJene self-assigned this Mar 28, 2022
@MarJene MarJene added the bug label Mar 28, 2022
@MarJene MarJene requested a review from oriolpiera March 28, 2022 16:08
@MarJene MarJene merged commit a73bc6a into master Mar 29, 2022
@MarJene MarJene deleted the FIX_fromkeys_same_list branch March 29, 2022 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant