Back

Debt-It V2

author-image

By Amir

Published on May 30, 2022

Track debts/bills between your friends, travel buddies, family and roommates easily.

About the app

debt-it

About

This app is a solution for settling debts in group expenses. Every user in this app can build a team by inviting other users to the group. Here, they can track expenses, see the balance, and also check who’s the debitor and who’s the creditor.

With this app, you wouldn’t have to calculate the expense balance for your group, all you need to do is check-in the expenses and you can see the creditors, the debitors and amount needed to be paid right away.

The algorithm integrated in the app will minimise the amount of transaction needed to clear out debts between group members.

Techstacks Changes

Code Snippets

Backend: src/utils/calculations.ts

export const getTotalSpent = ({ allExpenses }: GetTotalSpent): number => {
  return allExpenses?.reduce((acc: number, expense: ExpenseDocument) => {
    if (expense.payback) {
      return acc;
    } else {
      return acc + expense.amount;
    }
  }, 0);
};

This is a backend function that is used to calculate the current total spending of a user.