Skip to content

Commit

Permalink
Remove dead settlement code (we switched to an external lib long ago)
Browse files Browse the repository at this point in the history
  • Loading branch information
Baptiste Jonglez committed Mar 29, 2024
1 parent a3d4e42 commit eef67cf
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions ihatemoney/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ def prettify(transactions, pretty_output):
)
return pretty_transactions

# cache value for better performance
members = {person.id: person for person in self.members}
settle_plan = settle(self.balance.items()) or []

Expand All @@ -225,22 +224,6 @@ def prettify(transactions, pretty_output):

return prettify(transactions, pretty_output)

def exactmatch(self, credit, debts):
"""Recursively try and find subsets of 'debts' whose sum is equal to credit"""
if not debts:
return None
if debts[0]["balance"] > credit:
return self.exactmatch(credit, debts[1:])
elif debts[0]["balance"] == credit:
return [debts[0]]
else:
match = self.exactmatch(credit - debts[0]["balance"], debts[1:])
if match:
match.append(debts[0])
else:
match = self.exactmatch(credit, debts[1:])
return match

def has_bills(self):
"""return if the project do have bills or not"""
return self.get_bills_unordered().count() > 0
Expand Down

0 comments on commit eef67cf

Please sign in to comment.