Round score
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
f7d747cd76
commit
b88d284859
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"math"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -118,7 +119,7 @@ func declareAPIAuthSurveysRoutes(router *gin.RouterGroup) {
|
||||||
if score == nil {
|
if score == nil {
|
||||||
c.JSON(http.StatusOK, map[string]string{"score": "N/A"})
|
c.JSON(http.StatusOK, map[string]string{"score": "N/A"})
|
||||||
} else {
|
} else {
|
||||||
c.JSON(http.StatusOK, map[string]float64{"score": *score})
|
c.JSON(http.StatusOK, map[string]float64{"score": math.Round(*score*10) / 10})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
c.AbortWithStatusJSON(http.StatusForbidden, gin.H{"errmsg": "Not accessible"})
|
c.AbortWithStatusJSON(http.StatusForbidden, gin.H{"errmsg": "Not accessible"})
|
||||||
|
|
Reference in New Issue