Jay-Rajput commited on
Commit
332f07c
Β·
1 Parent(s): 6ab428e

points redistribution

Browse files
Files changed (2) hide show
  1. app.py +11 -11
  2. leaders/users.json +50 -50
app.py CHANGED
@@ -355,7 +355,7 @@ def redistribute_lost_points(match_id) -> dict:
355
 
356
  # Record this match as done
357
  done_matches.append(match_id)
358
- with open(REDISTRIBUTED_JSON, "w") as f:
359
  json.dump(done_matches, f, indent=2)
360
 
361
  return bonus_map
@@ -367,25 +367,25 @@ def display_leaderboard():
367
  dataset = load_dataset("Jay-Rajput/DIS_IPL_Leads", split='train')
368
 
369
  # Load outcomes data from HF instead of local file
370
- outcome_dataset = load_dataset("Jay-Rajput/DIS_IPL_Outcomes", split='train')
371
- latest_match_id = outcome_dataset[-1]["match_id"] if outcome_dataset else None
372
 
373
- # Redistribute points only once per match
374
- bonus_map = {}
375
- if latest_match_id:
376
- bonus_map = redistribute_lost_points(latest_match_id)
377
 
378
  users_data = []
379
  if dataset:
380
  for user, points_dict in dataset[0].items():
381
  points = points_dict.get("points", 0)
382
  last_5_results = " ".join(points_dict.get("last_5_results", ["βšͺ"] * 5)) # Default: 5 white circles
383
- bonus = bonus_map.get(user, 0)
384
  users_data.append({
385
  'User': user,
386
  'Points': points,
387
- 'Last 5 Bids': last_5_results,
388
- 'Redistribution Bonus': bonus
389
  })
390
  else:
391
  st.warning("No leaderboard data found.")
@@ -399,7 +399,7 @@ def display_leaderboard():
399
  leaderboard['Rank'] = range(1, len(leaderboard) + 1)
400
 
401
  # Select and order the columns for display
402
- leaderboard = leaderboard[['Rank', 'User', 'Points', 'Redistribution Bonus', 'Last 5 Bids']]
403
 
404
  st.dataframe(leaderboard, hide_index=True)
405
  except Exception as e:
 
355
 
356
  # Record this match as done
357
  done_matches.append(match_id)
358
+ with open(BONUS_JSON, "w") as f:
359
  json.dump(done_matches, f, indent=2)
360
 
361
  return bonus_map
 
367
  dataset = load_dataset("Jay-Rajput/DIS_IPL_Leads", split='train')
368
 
369
  # Load outcomes data from HF instead of local file
370
+ # outcome_dataset = load_dataset("Jay-Rajput/DIS_IPL_Outcomes", split='train')
371
+ # latest_match_id = outcome_dataset[-1]["match_id"] if outcome_dataset else None
372
 
373
+ # # Redistribute points only once per match
374
+ # bonus_map = {}
375
+ # if latest_match_id:
376
+ # bonus_map = redistribute_lost_points(latest_match_id)
377
 
378
  users_data = []
379
  if dataset:
380
  for user, points_dict in dataset[0].items():
381
  points = points_dict.get("points", 0)
382
  last_5_results = " ".join(points_dict.get("last_5_results", ["βšͺ"] * 5)) # Default: 5 white circles
383
+ # bonus = bonus_map.get(user, 0)
384
  users_data.append({
385
  'User': user,
386
  'Points': points,
387
+ 'Last 5 Bids': last_5_results
388
+ # 'Redistribution Bonus': bonus
389
  })
390
  else:
391
  st.warning("No leaderboard data found.")
 
399
  leaderboard['Rank'] = range(1, len(leaderboard) + 1)
400
 
401
  # Select and order the columns for display
402
+ leaderboard = leaderboard[['Rank', 'User', 'Points', 'Last 5 Bids']]
403
 
404
  st.dataframe(leaderboard, hide_index=True)
405
  except Exception as e:
leaders/users.json CHANGED
@@ -7,7 +7,7 @@
7
  "πŸ”΄",
8
  "πŸ”΄"
9
  ],
10
- "points": 311,
11
  "wildcard": [
12
  0,
13
  0,
@@ -17,12 +17,12 @@
17
  "Ganesh": {
18
  "last_5_results": [
19
  "βšͺ",
20
- "πŸ”΄",
21
  "βšͺ",
 
22
  "βšͺ",
23
  "βšͺ"
24
  ],
25
- "points": 100,
26
  "wildcard": [
27
  0,
28
  0,
@@ -31,13 +31,13 @@
31
  },
32
  "Haaris": {
33
  "last_5_results": [
 
34
  "βšͺ",
35
  "πŸ”΄",
36
  "πŸ”΄",
37
- "βšͺ",
38
  "βšͺ"
39
  ],
40
- "points": 0,
41
  "wildcard": [
42
  0,
43
  0,
@@ -46,13 +46,13 @@
46
  },
47
  "Jay": {
48
  "last_5_results": [
49
- "🟒",
50
  "πŸ”΄",
 
51
  "πŸ”΄",
52
  "πŸ”΄",
53
  "πŸ”΄"
54
  ],
55
- "points": 6842,
56
  "wildcard": [
57
  0,
58
  0,
@@ -61,13 +61,13 @@
61
  },
62
  "Kishore": {
63
  "last_5_results": [
64
- "πŸ”΄",
65
  "βšͺ",
66
  "πŸ”΄",
67
  "βšͺ",
68
- "🟒"
 
69
  ],
70
- "points": 17900,
71
  "wildcard": [
72
  0,
73
  0,
@@ -76,13 +76,13 @@
76
  },
77
  "Megha": {
78
  "last_5_results": [
 
79
  "πŸ”΄",
80
  "βšͺ",
81
  "πŸ”΄",
82
- "πŸ”΄",
83
  "πŸ”΄"
84
  ],
85
- "points": 6300,
86
  "wildcard": [
87
  0,
88
  0,
@@ -91,13 +91,13 @@
91
  },
92
  "Naveein": {
93
  "last_5_results": [
 
94
  "βšͺ",
95
  "🟒",
96
  "πŸ”΄",
97
- "βšͺ",
98
- "🟒"
99
  ],
100
- "points": 18000,
101
  "wildcard": [
102
  0,
103
  0,
@@ -112,7 +112,7 @@
112
  "βšͺ",
113
  "βšͺ"
114
  ],
115
- "points": 200,
116
  "wildcard": [
117
  0,
118
  0,
@@ -121,11 +121,11 @@
121
  },
122
  "Praveen": {
123
  "last_5_results": [
 
124
  "βšͺ",
125
  "βšͺ",
126
  "πŸ”΄",
127
- "βšͺ",
128
- "πŸ”΄"
129
  ],
130
  "points": 4300,
131
  "wildcard": [
@@ -136,13 +136,13 @@
136
  },
137
  "Rakesh": {
138
  "last_5_results": [
 
139
  "πŸ”΄",
140
  "🟒",
141
  "🟒",
142
- "πŸ”΄",
143
- "βšͺ"
144
  ],
145
- "points": 4130,
146
  "wildcard": [
147
  0,
148
  0,
@@ -151,13 +151,13 @@
151
  },
152
  "Sai": {
153
  "last_5_results": [
 
154
  "🟒",
155
  "βšͺ",
156
  "πŸ”΄",
157
- "🟒",
158
- "πŸ”΄"
159
  ],
160
- "points": 17808,
161
  "wildcard": [
162
  0,
163
  0,
@@ -166,13 +166,13 @@
166
  },
167
  "Sunil": {
168
  "last_5_results": [
169
- "βšͺ",
170
  "πŸ”΄",
 
171
  "πŸ”΄",
172
  "πŸ”΄",
173
- "βšͺ"
174
  ],
175
- "points": 18140,
176
  "wildcard": [
177
  0,
178
  0,
@@ -181,13 +181,13 @@
181
  },
182
  "Vaibhav": {
183
  "last_5_results": [
 
184
  "βšͺ",
185
  "πŸ”΄",
186
  "πŸ”΄",
187
- "βšͺ",
188
- "🟒"
189
  ],
190
- "points": 13300,
191
  "wildcard": [
192
  0,
193
  0,
@@ -196,13 +196,13 @@
196
  },
197
  "Vinay": {
198
  "last_5_results": [
 
199
  "πŸ”΄",
200
  "🟒",
201
  "πŸ”΄",
202
- "βšͺ",
203
  "βšͺ"
204
  ],
205
- "points": 5180,
206
  "wildcard": [
207
  0,
208
  0,
@@ -217,7 +217,7 @@
217
  "βšͺ",
218
  "βšͺ"
219
  ],
220
- "points": 2300,
221
  "wildcard": [
222
  0,
223
  0,
@@ -232,7 +232,7 @@
232
  "βšͺ",
233
  "βšͺ"
234
  ],
235
- "points": 200,
236
  "wildcard": [
237
  0,
238
  0,
@@ -242,12 +242,12 @@
242
  "Biswabarenya": {
243
  "last_5_results": [
244
  "βšͺ",
245
- "πŸ”΄",
246
  "βšͺ",
 
247
  "βšͺ",
248
- "🟒"
249
  ],
250
- "points": 3300,
251
  "wildcard": [
252
  0,
253
  0,
@@ -256,13 +256,13 @@
256
  },
257
  "Naitik": {
258
  "last_5_results": [
 
259
  "🟒",
260
  "βšͺ",
261
  "πŸ”΄",
262
- "🟒",
263
  "🟒"
264
  ],
265
- "points": 23450,
266
  "wildcard": [
267
  0,
268
  0,
@@ -271,13 +271,13 @@
271
  },
272
  "Alekhya": {
273
  "last_5_results": [
 
274
  "βšͺ",
275
  "🟒",
276
  "πŸ”΄",
277
- "🟒",
278
- "βšͺ"
279
  ],
280
- "points": 4700,
281
  "wildcard": [
282
  0,
283
  0,
@@ -289,10 +289,10 @@
289
  "βšͺ",
290
  "βšͺ",
291
  "βšͺ",
292
- "πŸ”΄",
293
- "βšͺ"
294
  ],
295
- "points": 0,
296
  "wildcard": [
297
  0,
298
  0,
@@ -301,13 +301,13 @@
301
  },
302
  "Priyavrat Mohan": {
303
  "last_5_results": [
 
304
  "🟒",
305
  "πŸ”΄",
306
  "πŸ”΄",
307
- "🟒",
308
- "πŸ”΄"
309
  ],
310
- "points": 10450,
311
  "wildcard": [
312
  0,
313
  0,
@@ -317,12 +317,12 @@
317
  "Satish": {
318
  "last_5_results": [
319
  "🟒",
320
- "πŸ”΄",
321
  "🟒",
322
  "πŸ”΄",
 
323
  "πŸ”΄"
324
  ],
325
- "points": 17300,
326
  "wildcard": [
327
  0,
328
  0,
 
7
  "πŸ”΄",
8
  "πŸ”΄"
9
  ],
10
+ "points": 1000,
11
  "wildcard": [
12
  0,
13
  0,
 
17
  "Ganesh": {
18
  "last_5_results": [
19
  "βšͺ",
 
20
  "βšͺ",
21
+ "πŸ”΄",
22
  "βšͺ",
23
  "βšͺ"
24
  ],
25
+ "points": 1000,
26
  "wildcard": [
27
  0,
28
  0,
 
31
  },
32
  "Haaris": {
33
  "last_5_results": [
34
+ "βšͺ",
35
  "βšͺ",
36
  "πŸ”΄",
37
  "πŸ”΄",
 
38
  "βšͺ"
39
  ],
40
+ "points": 1000,
41
  "wildcard": [
42
  0,
43
  0,
 
46
  },
47
  "Jay": {
48
  "last_5_results": [
 
49
  "πŸ”΄",
50
+ "🟒",
51
  "πŸ”΄",
52
  "πŸ”΄",
53
  "πŸ”΄"
54
  ],
55
+ "points": 7542,
56
  "wildcard": [
57
  0,
58
  0,
 
61
  },
62
  "Kishore": {
63
  "last_5_results": [
 
64
  "βšͺ",
65
  "πŸ”΄",
66
  "βšͺ",
67
+ "πŸ”΄",
68
+ "βšͺ"
69
  ],
70
+ "points": 18700,
71
  "wildcard": [
72
  0,
73
  0,
 
76
  },
77
  "Megha": {
78
  "last_5_results": [
79
+ "🟒",
80
  "πŸ”΄",
81
  "βšͺ",
82
  "πŸ”΄",
 
83
  "πŸ”΄"
84
  ],
85
+ "points": 10300,
86
  "wildcard": [
87
  0,
88
  0,
 
91
  },
92
  "Naveein": {
93
  "last_5_results": [
94
+ "πŸ”΄",
95
  "βšͺ",
96
  "🟒",
97
  "πŸ”΄",
98
+ "βšͺ"
 
99
  ],
100
+ "points": 18200,
101
  "wildcard": [
102
  0,
103
  0,
 
112
  "βšͺ",
113
  "βšͺ"
114
  ],
115
+ "points": 1000,
116
  "wildcard": [
117
  0,
118
  0,
 
121
  },
122
  "Praveen": {
123
  "last_5_results": [
124
+ "πŸ”΄",
125
  "βšͺ",
126
  "βšͺ",
127
  "πŸ”΄",
128
+ "βšͺ"
 
129
  ],
130
  "points": 4300,
131
  "wildcard": [
 
136
  },
137
  "Rakesh": {
138
  "last_5_results": [
139
+ "πŸ”΄",
140
  "πŸ”΄",
141
  "🟒",
142
  "🟒",
143
+ "πŸ”΄"
 
144
  ],
145
+ "points": 4680,
146
  "wildcard": [
147
  0,
148
  0,
 
151
  },
152
  "Sai": {
153
  "last_5_results": [
154
+ "βšͺ",
155
  "🟒",
156
  "βšͺ",
157
  "πŸ”΄",
158
+ "🟒"
 
159
  ],
160
+ "points": 18608,
161
  "wildcard": [
162
  0,
163
  0,
 
166
  },
167
  "Sunil": {
168
  "last_5_results": [
 
169
  "πŸ”΄",
170
+ "βšͺ",
171
  "πŸ”΄",
172
  "πŸ”΄",
173
+ "πŸ”΄"
174
  ],
175
+ "points": 18829,
176
  "wildcard": [
177
  0,
178
  0,
 
181
  },
182
  "Vaibhav": {
183
  "last_5_results": [
184
+ "βšͺ",
185
  "βšͺ",
186
  "πŸ”΄",
187
  "πŸ”΄",
188
+ "βšͺ"
 
189
  ],
190
+ "points": 14100,
191
  "wildcard": [
192
  0,
193
  0,
 
196
  },
197
  "Vinay": {
198
  "last_5_results": [
199
+ "πŸ”΄",
200
  "πŸ”΄",
201
  "🟒",
202
  "πŸ”΄",
 
203
  "βšͺ"
204
  ],
205
+ "points": 5480,
206
  "wildcard": [
207
  0,
208
  0,
 
217
  "βšͺ",
218
  "βšͺ"
219
  ],
220
+ "points": 3100,
221
  "wildcard": [
222
  0,
223
  0,
 
232
  "βšͺ",
233
  "βšͺ"
234
  ],
235
+ "points": 1000,
236
  "wildcard": [
237
  0,
238
  0,
 
242
  "Biswabarenya": {
243
  "last_5_results": [
244
  "βšͺ",
 
245
  "βšͺ",
246
+ "πŸ”΄",
247
  "βšͺ",
248
+ "βšͺ"
249
  ],
250
+ "points": 4100,
251
  "wildcard": [
252
  0,
253
  0,
 
256
  },
257
  "Naitik": {
258
  "last_5_results": [
259
+ "πŸ”΄",
260
  "🟒",
261
  "βšͺ",
262
  "πŸ”΄",
 
263
  "🟒"
264
  ],
265
+ "points": 23950,
266
  "wildcard": [
267
  0,
268
  0,
 
271
  },
272
  "Alekhya": {
273
  "last_5_results": [
274
+ "βšͺ",
275
  "βšͺ",
276
  "🟒",
277
  "πŸ”΄",
278
+ "🟒"
 
279
  ],
280
+ "points": 5500,
281
  "wildcard": [
282
  0,
283
  0,
 
289
  "βšͺ",
290
  "βšͺ",
291
  "βšͺ",
292
+ "βšͺ",
293
+ "πŸ”΄"
294
  ],
295
+ "points": 1000,
296
  "wildcard": [
297
  0,
298
  0,
 
301
  },
302
  "Priyavrat Mohan": {
303
  "last_5_results": [
304
+ "πŸ”΄",
305
  "🟒",
306
  "πŸ”΄",
307
  "πŸ”΄",
308
+ "🟒"
 
309
  ],
310
+ "points": 11100,
311
  "wildcard": [
312
  0,
313
  0,
 
317
  "Satish": {
318
  "last_5_results": [
319
  "🟒",
 
320
  "🟒",
321
  "πŸ”΄",
322
+ "🟒",
323
  "πŸ”΄"
324
  ],
325
+ "points": 21300,
326
  "wildcard": [
327
  0,
328
  0,