chore: fix typo

This commit is contained in:
uetchy 2021-10-27 22:42:12 +09:00
parent 073368e311
commit 6cb2442786

View File

@ -61,13 +61,13 @@ const data = new Map();
for (const { payer, amount, involves } of history) {
const record = data.fetch(payer);
record.balance += amount;
const dept = Math.ceil(amount / involves.length);
// actual payer should not owe extra dept coming from rounded up numbers
const payerDept = amount - dept * (involves.length - 1);
for (const deptor of involves.map((i) => data.fetch(i))) {
const debt = Math.ceil(amount / involves.length);
// actual payer should not owe extra debt coming from rounded up numbers
const payerDebt = amount - debt * (involves.length - 1);
for (const debtor of involves.map((i) => data.fetch(i))) {
const cost = Math.round(amount / involves.length);
deptor.balance -= cost;
deptor.consumption += cost;
debtor.balance -= cost;
debtor.consumption += cost;
}
}