openlibhums / consortial_billing

A plugin for Janeway for managing supporters.
GNU General Public License v3.0
0 stars 1 forks source link

Duplicate bands cause an error on signup #52

Closed joemull closed 7 months ago

joemull commented 8 months ago

The error is caused by the assumption that there will only be one matching band, but this is not a safe assumption:

https://github.com/BirkbeckCTP/consortial_billing/blob/01fc19c36755b2306218986f6bcb5fba301fb822/forms.py#L54-L65

Short term solution: use a try and except to get the latest or create a new one.

Long term solution: add a form test for this case.

joemull commented 8 months ago

The duplicate bands seem to have been created by not using the band form save method in calculate_all_fees. Need to add this and test it.