fix(transaction): #151 float error | -17.49 parsed as -17.48
All checks were successful
Build Docker Image / Build-Docker-Image (push) Successful in 5m39s
Build and Push Docker Image / Build-And-Push-Docker-Image (push) Successful in 5m47s

This commit was merged in pull request #157.
This commit is contained in:
2025-06-07 13:36:27 +02:00
parent 79a1247bea
commit e65146c71c
2 changed files with 5 additions and 3 deletions

View File

@@ -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 {