This commit is contained in:
xds
2025-03-10 12:55:44 +03:00
parent 98263732ca
commit 94df5d72c3

View File

@@ -204,6 +204,7 @@ class FinancialService(
isCategoryChanged: Boolean = false, isCategoryChanged: Boolean = false,
isOldCategory: Boolean = false isOldCategory: Boolean = false
): Double { ): Double {
return if (transaction.category.type.code == "EXPENSE") {
val sums = getBudgetSumsByCategory(transaction.category.id!!, budget) val sums = getBudgetSumsByCategory(transaction.category.id!!, budget)
val categoryBudget = budget.categories.firstOrNull { it.category.id == transaction.category.id } val categoryBudget = budget.categories.firstOrNull { it.category.id == transaction.category.id }
?: throw NotFoundException("Not found category in budget") ?: throw NotFoundException("Not found category in budget")
@@ -217,7 +218,8 @@ class FinancialService(
} else categoryBudget.currentLimit += difference } else categoryBudget.currentLimit += difference
} }
budgetRepo.save(budget).awaitSingle() budgetRepo.save(budget).awaitSingle()
return 1.0 1.0
} else 0.0
} }