Jay-Rajput commited on
Commit
9a6897a
·
1 Parent(s): 506f77e

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,