From b88d28485979071932f447de6bc9cab1fb6846c6 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sun, 20 Nov 2022 13:30:12 +0100 Subject: [PATCH] Round score --- surveys.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/surveys.go b/surveys.go index ec3eb6d..2afe45c 100644 --- a/surveys.go +++ b/surveys.go @@ -3,6 +3,7 @@ package main import ( "fmt" "log" + "math" "net/http" "strconv" "strings" @@ -118,7 +119,7 @@ func declareAPIAuthSurveysRoutes(router *gin.RouterGroup) { if score == nil { c.JSON(http.StatusOK, map[string]string{"score": "N/A"}) } else { - c.JSON(http.StatusOK, map[string]float64{"score": *score}) + c.JSON(http.StatusOK, map[string]float64{"score": math.Round(*score*10) / 10}) } } else { c.AbortWithStatusJSON(http.StatusForbidden, gin.H{"errmsg": "Not accessible"})