chore: fix
This commit is contained in:
@@ -50,6 +50,15 @@ func GetMyCompletedOrders(c *gin.Context) {
|
||||
// ✅ Récupérer les infos client pour statistiques
|
||||
client, err := database.GetClientByUsername(usernameStr)
|
||||
|
||||
// ✅ Récupérer les noms des pools de points
|
||||
poolNames := []string{"Pool 1", "Pool 2"}
|
||||
if settings, sErr := database.GetSettings(); sErr == nil && len(settings.PointsPools) > 0 {
|
||||
poolNames = make([]string, len(settings.PointsPools))
|
||||
for i, p := range settings.PointsPools {
|
||||
poolNames[i] = p.Name
|
||||
}
|
||||
}
|
||||
|
||||
response := gin.H{
|
||||
"success": true,
|
||||
"commands": commands,
|
||||
@@ -57,10 +66,21 @@ func GetMyCompletedOrders(c *gin.Context) {
|
||||
}
|
||||
|
||||
if err == nil && client != nil {
|
||||
// Construire le tableau générique des valeurs par pool
|
||||
poolPoints := make([]int, len(poolNames))
|
||||
if len(poolPoints) > 0 {
|
||||
poolPoints[0] = client.Point
|
||||
}
|
||||
if len(poolPoints) > 1 {
|
||||
poolPoints[1] = client.PointZipette
|
||||
}
|
||||
|
||||
response["client_stats"] = gin.H{
|
||||
"username": client.Username,
|
||||
"total_commands": client.Command,
|
||||
"points": client.Point,
|
||||
"pool_points": poolPoints,
|
||||
"pool_names": poolNames,
|
||||
"penalties": client.Amende,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user