Round score instead of floor + display score100 to player

This commit is contained in:
nemunaire 2025-03-30 13:31:52 +02:00
parent a0cb395c79
commit 9f25bc54d3
3 changed files with 5 additions and 4 deletions

View file

@ -36,7 +36,7 @@
<tfoot> <tfoot>
<th></th> <th></th>
<th></th> <th></th>
<th>{{ my.score }}</th> <th>{{ my.score100 / 100 }}</th>
</thead> </thead>
</tbody> </tbody>
</table> </table>

View file

@ -95,7 +95,7 @@
<Nav class="ms-auto text-light" navbar> <Nav class="ms-auto text-light" navbar>
{#if $my && $my.team_id} {#if $my && $my.team_id}
<NavItem> <NavItem>
{Math.round($my.score*100)/100} {$my.score === 1 ? 'point' : 'points'} {$my.score100/100} {Math.abs($my.score) < 2 ? 'point' : 'points'}
{#if $teams && $teams[$my.team_id] && $teams[$my.team_id].rank} {#if $teams && $teams[$my.team_id] && $teams[$my.team_id].rank}
&ndash; {$teams[$my.team_id].rank}<sup>e</sup> sur {Object.keys($teams).length} &ndash; {$teams[$my.team_id].rank}<sup>e</sup> sur {Object.keys($teams).length}
{/if} {/if}

View file

@ -5,6 +5,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"log" "log"
"math"
"os" "os"
"path" "path"
"sort" "sort"
@ -124,8 +125,8 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
ret.Name = t.Name ret.Name = t.Name
ret.Id = t.Id ret.Id = t.Id
points, _ := t.GetPoints() points, _ := t.GetPoints()
ret.Points = int64(float64(points) * GlobalScoreCoefficient) ret.Points = int64(math.Round(float64(points) * GlobalScoreCoefficient))
ret.Points100 = int64(float64(points) * GlobalScoreCoefficient * 100) ret.Points100 = int64(math.Round(float64(points) * GlobalScoreCoefficient * 100))
if members, err := t.GetMembers(); err == nil { if members, err := t.GetMembers(); err == nil {
ret.Members = members ret.Members = members
} }