dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 725356b4a85c025e89140186bcc374094953d6c4
parent e6e7d7a2cc48807832e25c1780c569c17af314c6
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Fri, 16 Jun 2023 19:58:33 -0700

fix graph column width

Diffstat:
Mpkg/web/handlers/chess.go | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkg/web/handlers/chess.go b/pkg/web/handlers/chess.go @@ -372,7 +372,7 @@ func ChessGameStatsHandler(c echo.Context) error { moveIdx := currMoveIdx const graphWidth = 800 - var columnWidth = 1 + var columnWidth = 1.0 var stats *interceptors.AnalyseResult _ = json.Unmarshal(g.DbChessGame.Stats, &stats) @@ -405,7 +405,7 @@ func ChessGameStatsHandler(c echo.Context) error { var bestMove string if stats != nil { if len(stats.Scores) > 0 { - columnWidth = utils.MaxInt(graphWidth/len(stats.Scores), 1) + columnWidth = math.Max(graphWidth/float64(len(stats.Scores)), 1) if moveIdx > 0 { bestMove = stats.Scores[moveIdx-1].BestMove }