chore: fix typo
This commit is contained in:
parent
073368e311
commit
6cb2442786
@ -61,13 +61,13 @@ const data = new Map();
|
|||||||
for (const { payer, amount, involves } of history) {
|
for (const { payer, amount, involves } of history) {
|
||||||
const record = data.fetch(payer);
|
const record = data.fetch(payer);
|
||||||
record.balance += amount;
|
record.balance += amount;
|
||||||
const dept = Math.ceil(amount / involves.length);
|
const debt = Math.ceil(amount / involves.length);
|
||||||
// actual payer should not owe extra dept coming from rounded up numbers
|
// actual payer should not owe extra debt coming from rounded up numbers
|
||||||
const payerDept = amount - dept * (involves.length - 1);
|
const payerDebt = amount - debt * (involves.length - 1);
|
||||||
for (const deptor of involves.map((i) => data.fetch(i))) {
|
for (const debtor of involves.map((i) => data.fetch(i))) {
|
||||||
const cost = Math.round(amount / involves.length);
|
const cost = Math.round(amount / involves.length);
|
||||||
deptor.balance -= cost;
|
debtor.balance -= cost;
|
||||||
deptor.consumption += cost;
|
debtor.consumption += cost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user