Prevent transaction amount with commas to give wrong results
This commit is contained in:
parent
e593d0fda0
commit
ec5e556dde
1 changed files with 6 additions and 1 deletions
|
@ -40,8 +40,13 @@ class TransactionsController < ApplicationController
|
|||
debtor: User.find_by(name: t[:debtor]) || User.zeus,
|
||||
creditor: User.find_by(name: t[:creditor]) || User.zeus,
|
||||
issuer: current_client || current_user,
|
||||
amount: (t[:euros].to_f*100 + t[:cents].to_f).to_i,
|
||||
amount: (float(t[:euros]) * 100 + float(t[:cents])).to_i,
|
||||
message: t[:message]
|
||||
}
|
||||
end
|
||||
|
||||
def float arg
|
||||
if arg.is_a? String then arg.sub!(',', '.') end
|
||||
arg.to_f
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue