Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

Fix: Remove blank amount from transaction entry parameters (#1178)

sentry[bot]d7a3b0cacd61
diff --git a/app/controllers/transactions_controller.rb b/app/controllers/transactions_controller.rb
index 0769435295..00bc8f0dac 100644
--- a/app/controllers/transactions_controller.rb
+++ b/app/controllers/transactions_controller.rb
@@ -331,6 +331,8 @@ class TransactionsController < ApplicationController
nature = entry_params.delete(:nature)
+ entry_params.delete(:amount) if entry_params[:amount].blank?
+
if nature.present? && entry_params[:amount].present?
signed_amount = nature == "inflow" ? -entry_params[:amount].to_d : entry_params[:amount].to_d
entry_params = entry_params.merge(amount: signed_amount)