fix(transaction): #151 float error | -17.49 parsed as -17.48
This commit was merged in pull request #157.
This commit is contained in:
@@ -2,6 +2,7 @@ package handler
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"net/http"
|
||||
"spend-sparrow/internal/handler/middleware"
|
||||
"spend-sparrow/internal/service"
|
||||
@@ -193,7 +194,7 @@ func (h TransactionImpl) handleUpdateTransaction() http.HandlerFunc {
|
||||
handleError(w, r, fmt.Errorf("could not parse value: %w", service.ErrBadRequest))
|
||||
return
|
||||
}
|
||||
value := int64(valueF * service.DECIMALS_MULTIPLIER)
|
||||
value := int64(math.Round(valueF * service.DECIMALS_MULTIPLIER))
|
||||
|
||||
timestamp, err := time.Parse("2006-01-02", r.FormValue("timestamp"))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user