TheAxelander / OpenBudgeteer

OpenBudgeteer is a budgeting app based on the Bucket Budgeting Principle
https://theaxelander.github.io
MIT License
759 stars 43 forks source link

Correctly detect potential duplicates if payee or memo is equal #156

Closed Lucaber closed 1 year ago

Lucaber commented 1 year ago

Fixes GetHashCode to work with the Equals function to detect potential duplicates if payee OR memo is equal.

Two objects that are equal return hash codes that are equal. However, the reverse is not true: equal hash codes do not imply object equality, because different (unequal) objects can have identical hash codes.

https://learn.microsoft.com/en-us/dotnet/api/system.object.gethashcode?view=net-7.0#remarks

Now two transactions return the same hashcode and the Equals function is used to determine whether they are potential duplicates.

TheAxelander commented 1 year ago

Good catch. Thanks a lot for that.