Use printf in template
This commit is contained in:
1 parent
696469f6c2
commit
a4659c7133
3 files changed
+5
-7
No files matched your search
+2
-1
@@ -116,7 +116,7 @@ func trimLastChar(s string) string {
|
||||
}
|
||||
|
||||
func GetAmount(inflow string, outflow string) (pgtype.Numeric, error) {
|
||||
// Remove currency
|
||||
// Remove trailing currency
|
||||
inflow = strings.Replace(trimLastChar(inflow), ",", ".", 1)
|
||||
outflow = strings.Replace(trimLastChar(outflow), ",", ".", 1)
|
||||
|
||||
@@ -126,6 +126,7 @@ func GetAmount(inflow string, outflow string) (pgtype.Numeric, error) {
|
||||
return num, fmt.Errorf("Could not parse inflow %s: %w", inflow, err)
|
||||
}
|
||||
|
||||
// if inflow is zero, use outflow
|
||||
if num.Int.Int64() != 0 {
|
||||
return num, nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user