chore: update
This commit is contained in:
@@ -735,7 +735,25 @@ func GetClientCommandsHistory(c *gin.Context) {
|
||||
"count": len(commands),
|
||||
}
|
||||
|
||||
if err == nil && client != nil { // ✅ VÉRIFIE AUSSI que client != nil
|
||||
if err == nil && client != nil {
|
||||
// Récupérer les pools configurés par l'admin
|
||||
poolNames := []string{}
|
||||
poolKeys := []string{}
|
||||
if settings, sErr := database.GetSettings(); sErr == nil && len(settings.PointsPools) > 0 {
|
||||
for _, p := range settings.PointsPools {
|
||||
poolNames = append(poolNames, p.Name)
|
||||
poolKeys = append(poolKeys, p.Key)
|
||||
}
|
||||
}
|
||||
|
||||
// Construire pool_points depuis points_extra[pool.Key] (stockage dynamique)
|
||||
poolPoints := make([]int, len(poolKeys))
|
||||
for i, key := range poolKeys {
|
||||
if key != "" {
|
||||
poolPoints[i] = client.PointsExtra[key]
|
||||
}
|
||||
}
|
||||
|
||||
resp["client_stats"] = gin.H{
|
||||
"username": client.Username,
|
||||
"nom": client.Nom,
|
||||
@@ -743,12 +761,13 @@ func GetClientCommandsHistory(c *gin.Context) {
|
||||
"telephone": client.Telephone,
|
||||
"total_commands": client.Command,
|
||||
"points": client.Point,
|
||||
"points_zipette": client.PointZipette,
|
||||
"pool_points": poolPoints,
|
||||
"pool_names": poolNames,
|
||||
"penalties": client.Amende,
|
||||
}
|
||||
|
||||
log.Printf("✅ [HISTORY] Stats client: point=%d, point_zipette=%d",
|
||||
client.Point, client.PointZipette)
|
||||
log.Printf("📊 [HISTORY] pool_names=%v pool_keys=%v pool_points=%v extra=%v",
|
||||
poolNames, poolKeys, poolPoints, client.PointsExtra)
|
||||
} else {
|
||||
log.Printf("⚠️ [HISTORY] client_stats NON ajouté - err=%v, client=%v", err, client)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user