Skip to content

Group balances broken on 1 to 1 expenses #190

Closed

Description

@krokosik

When adding a group expense, I noticed some weird behaviour where the balances are reset to 0 if the expense involves only 1 person owing another different person.

How to replicate

  1. Seed the database and login as Alice
  2. In the Holiday Trip group create an expense where the full amount is paid by Bob and Alice is the only debtor
  3. The balance is not reflected in our group view

What is more, I checked with pgAdmin that if it happens with an existing balance, it is reset to zero! This is a critical issue as it can really mess up a group and all expenses would have to be added again.

I looked in the code and saw a function called updateGroupExpenseForIfBalanceIsZero in splitService.ts. Its purpose is unclear to me, as it seems to set the group balances to 0 if the total balance with our friend is zero. This is quite odd to me, as groups should be independent of what happens outside off them, but maybe @KMKoushik could you tell me more about the reasoning behind it?

Nevertheless, it has a bug and I am submitting a fix, which I believe should be released ASAP.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions