James McCool
commited on
Commit
·
dc9501e
1
Parent(s):
875d2e4
Enhance player information retrieval in app.py by adding contest name and ID map parameters to grab_contest_player_info function. Implemented error handling to filter player data based on contest ID for improved accuracy and data integrity.
Browse files
app.py
CHANGED
|
@@ -32,7 +32,7 @@ def grab_contest_names(db, sport, type):
|
|
| 32 |
|
| 33 |
return contest_names, contest_id_map, curr_info
|
| 34 |
|
| 35 |
-
def grab_contest_player_info(db, sport, type, contest_date):
|
| 36 |
if type == 'Classic':
|
| 37 |
db_type = 'reg'
|
| 38 |
elif type == 'Showdown':
|
|
@@ -42,7 +42,10 @@ def grab_contest_player_info(db, sport, type, contest_date):
|
|
| 42 |
|
| 43 |
player_info = pd.DataFrame(list(cursor)).drop('_id', axis=1)
|
| 44 |
player_info = player_info[player_info['Contest Date'] == contest_date]
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
| 46 |
player_info = player_info.rename(columns={'Display Name': 'Player'})
|
| 47 |
player_info = player_info.sort_values(by='Salary', ascending=True).drop_duplicates(subset='Player', keep='first')
|
| 48 |
|
|
|
|
| 32 |
|
| 33 |
return contest_names, contest_id_map, curr_info
|
| 34 |
|
| 35 |
+
def grab_contest_player_info(db, sport, type, contest_date, contest_name, contest_id_map):
|
| 36 |
if type == 'Classic':
|
| 37 |
db_type = 'reg'
|
| 38 |
elif type == 'Showdown':
|
|
|
|
| 42 |
|
| 43 |
player_info = pd.DataFrame(list(cursor)).drop('_id', axis=1)
|
| 44 |
player_info = player_info[player_info['Contest Date'] == contest_date]
|
| 45 |
+
try:
|
| 46 |
+
player_info = player_info[player_info['Contest ID'] == contest_id_map[contest_name]]
|
| 47 |
+
except:
|
| 48 |
+
pass
|
| 49 |
player_info = player_info.rename(columns={'Display Name': 'Player'})
|
| 50 |
player_info = player_info.sort_values(by='Salary', ascending=True).drop_duplicates(subset='Player', keep='first')
|
| 51 |
|