diff --git a/commands/receipts/receiptCommands.js b/commands/receipts/receiptCommands.js index c7f3cba..980ecf2 100644 --- a/commands/receipts/receiptCommands.js +++ b/commands/receipts/receiptCommands.js @@ -125,7 +125,7 @@ module.exports = { const allBudgets = db.prepare(` SELECT id, budget_amount, exchange_rate, start_date, end_date FROM weekly_budgets - ORDER BY start_date DESC + ORDER BY start_date ASC LIMIT 4 `).all(); @@ -140,7 +140,7 @@ module.exports = { `).all(budgetPeriod.id, targetUser.id); const totalSpentInPeriodEur = periodSpendings.reduce((acc, s) => acc + s.amount, 0); - const savedInPeriodEur = budgetPeriod.budget_amount - totalSpentInPeriodEur; + const savedInPeriodEur = Number(budgetPeriod.budget_amount) - Number(totalSpentInPeriodEur); cumulativeSavingsEur += savedInPeriodEur; statsDescription += `**Period: ${budgetPeriod.start_date} - ${budgetPeriod.end_date}**\n`;