k-mktr commited on
Commit
594d6e6
·
verified ·
1 Parent(s): 1c4f67f

Update leaderboard.py

Browse files
Files changed (1) hide show
  1. leaderboard.py +18 -18
leaderboard.py CHANGED
@@ -129,20 +129,20 @@ def get_leaderboard():
129
  # Get human readable name
130
  human_readable = get_human_readable_name(model)
131
 
132
- # Format the row (keeping numeric values as numbers)
133
  row = [
134
- 0, # Position placeholder (integer)
135
- human_readable, # String
136
- score, # Float (raw score for sorting)
137
- wins, # Integer
138
- losses, # Integer
139
- total_battles, # Integer
140
- win_rate # Float (raw rate for sorting)
141
  ]
142
  table_data.append(row)
143
 
144
  # Sort by score (descending)
145
- table_data.sort(key=lambda x: x[2], reverse=True) # No need for float() conversion now
146
 
147
  # Add position numbers after sorting
148
  for i, row in enumerate(table_data, 1):
@@ -195,20 +195,20 @@ def get_elo_leaderboard():
195
  # Get human readable name
196
  human_readable = get_human_readable_name(model)
197
 
198
- # Format the row (keeping numeric values as numbers)
199
  row = [
200
- 0, # Position placeholder (integer)
201
- human_readable, # String
202
- rating, # Float (raw rating for sorting)
203
- wins, # Integer
204
- losses, # Integer
205
- total_battles, # Integer
206
- win_rate # Float (raw rate for sorting)
207
  ]
208
  table_data.append(row)
209
 
210
  # Sort by ELO rating (descending)
211
- table_data.sort(key=lambda x: x[2], reverse=True) # No need for float() conversion now
212
 
213
  # Add position numbers after sorting
214
  for i, row in enumerate(table_data, 1):
 
129
  # Get human readable name
130
  human_readable = get_human_readable_name(model)
131
 
132
+ # Format the row with formatted strings for display
133
  row = [
134
+ 0, # Position placeholder (integer)
135
+ human_readable, # String
136
+ f"{score:.3f}", # Score formatted to 3 decimal places
137
+ wins, # Integer
138
+ losses, # Integer
139
+ total_battles, # Integer
140
+ f"{win_rate:.1%}" # Win rate as percentage
141
  ]
142
  table_data.append(row)
143
 
144
  # Sort by score (descending)
145
+ table_data.sort(key=lambda x: float(x[2].replace('%', '')), reverse=True)
146
 
147
  # Add position numbers after sorting
148
  for i, row in enumerate(table_data, 1):
 
195
  # Get human readable name
196
  human_readable = get_human_readable_name(model)
197
 
198
+ # Format the row with formatted strings for display
199
  row = [
200
+ 0, # Position placeholder (integer)
201
+ human_readable, # String
202
+ f"{rating:.1f}", # ELO rating formatted to 1 decimal place
203
+ wins, # Integer
204
+ losses, # Integer
205
+ total_battles, # Integer
206
+ f"{win_rate:.1%}" # Win rate as percentage
207
  ]
208
  table_data.append(row)
209
 
210
  # Sort by ELO rating (descending)
211
+ table_data.sort(key=lambda x: float(x[2]), reverse=True)
212
 
213
  # Add position numbers after sorting
214
  for i, row in enumerate(table_data, 1):