Skip to content

Commit

Permalink
disable installments
Browse files Browse the repository at this point in the history
  • Loading branch information
jl4guna committed Apr 1, 2024
1 parent eacee0f commit 0ee5a06
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { useMemo } from "react";

import type { User } from "~/models/user.server";
import {
getInstallmentsTotal,
getTotalSpent,
getUserInstallments,
getUserSpentOnPanini,
getUserTotalSpent,
} from "./models/dashboard/Transaction.server";
Expand Down Expand Up @@ -119,26 +117,26 @@ export async function getUserBalance(userId: string) {
const totalSpent = await getTotalSpent();
const spentOnPanini = await getUserSpentOnPanini(userId);
const paniniPaymentsToUser = await getPaniniTotalPaymentToUser(userId);
const installmentsTotal = await getInstallmentsTotal();
const totalUserInstallments = await getUserInstallments(userId);
// const installmentsTotal = await getInstallmentsTotal();
// const totalUserInstallments = await getUserInstallments(userId);

const totalPerUser = Dinero({
amount: totalSpent,
}).divide(2);

const totalInstallmentsPerUser = Dinero({
amount: installmentsTotal,
}).divide(2);
// const totalInstallmentsPerUser = Dinero({
// amount: installmentsTotal,
// }).divide(2);

const paymentsBalance = Dinero({ amount: payments.sent }).subtract(
Dinero({ amount: payments.received }),
);

const userBalance = Dinero({ amount: transactions })
.add(paymentsBalance)
.subtract(totalPerUser)
.add(Dinero({ amount: totalUserInstallments }))
.subtract(totalInstallmentsPerUser);
.subtract(totalPerUser);
// .add(Dinero({ amount: totalUserInstallments }))
// .subtract(totalInstallmentsPerUser);

const paniniBalance = Dinero({ amount: spentOnPanini }).subtract(
Dinero({ amount: paniniPaymentsToUser }),
Expand Down

0 comments on commit 0ee5a06

Please sign in to comment.