fix: use Math.round in place of truncating digits

This commit is contained in:
Tom French 2022-07-29 00:04:45 +01:00 committed by James Long
parent bb9c9927db
commit 04aa1731b5
2 changed files with 2 additions and 2 deletions

View file

@ -110,7 +110,7 @@ async function fillPrimaryChecking(handlers, account, payees, groups) {
transactions.push(transaction); transactions.push(transaction);
if (Math.random() < 0.2) { if (Math.random() < 0.2) {
let a = (transaction.amount / 3) | 0; let a = Math.round(transaction.amount / 3);
let pick = () => let pick = () =>
payee === incomePayee payee === incomePayee
? incomeGroup.categories.find(c => c.name === 'Income').id ? incomeGroup.categories.find(c => c.name === 'Income').id

View file

@ -185,7 +185,7 @@ export async function set3MonthAvg({ month }) {
'sum-amount-' + cat.id 'sum-amount-' + cat.id
); );
const avg = ((spent1 + spent2 + spent3) / 3) | 0; const avg = Math.round((spent1 + spent2 + spent3) / 3);
setBudget({ category: cat.id, month, amount: -avg }); setBudget({ category: cat.id, month, amount: -avg });
} }
}); });