player stats updated badges

This commit is contained in:
2025-11-12 19:05:44 +01:00
parent 43a9b63c95
commit aa01f4136d
4 changed files with 500 additions and 38 deletions
+14
View File
@@ -223,6 +223,9 @@ def analyze_player_performance(player_id, archives_data):
'best_tournament_score': 0,
'worst_tournament_score': float('inf'),
'average_tournament_score': 0,
'best_4_targets_score': 0,
'best_20_targets_score': 0,
'best_40_targets_score': 0,
'total_shots_fired': 0,
'performance_trend': [],
'tournament_history': [],
@@ -264,6 +267,17 @@ def analyze_player_performance(player_id, archives_data):
player_stats['total_shots_fired'] += shots_in_tournament
# Track format-specific best scores
if tournament_type == '4_targets':
if score > player_stats['best_4_targets_score']:
player_stats['best_4_targets_score'] = score
elif tournament_type == '20_targets':
if score > player_stats['best_20_targets_score']:
player_stats['best_20_targets_score'] = score
elif tournament_type == '40_targets':
if score > player_stats['best_40_targets_score']:
player_stats['best_40_targets_score'] = score
# Calculate and aggregate shot accuracy
if tournament_type in player_stats['shot_accuracy']:
shot_accuracy = calculate_shot_accuracy(participant)