James McCool
commited on
Commit
·
84af75a
1
Parent(s):
6c7f446
Update contest payout information retrieval in app.py
Browse files- Modified the grab_contest_payout_info function to include an additional parameter for contest_id, enhancing the filtering of payout information based on the specific contest.
- Updated the data loading process to pass the contest_id when retrieving payout information, ensuring accurate data retrieval aligned with the selected contest.
app.py
CHANGED
|
@@ -57,7 +57,7 @@ def grab_contest_player_info(db, sport, type, contest_date, contest_name, contes
|
|
| 57 |
|
| 58 |
return player_info, info_maps
|
| 59 |
|
| 60 |
-
def grab_contest_payout_info(db, sport, type, contest_date, contest_name, contest_id_map):
|
| 61 |
if type == 'Classic':
|
| 62 |
db_type = 'reg'
|
| 63 |
elif type == 'Showdown':
|
|
@@ -67,6 +67,7 @@ def grab_contest_payout_info(db, sport, type, contest_date, contest_name, contes
|
|
| 67 |
|
| 68 |
payout_info = pd.DataFrame(list(cursor)).drop('_id', axis=1)
|
| 69 |
payout_info = payout_info[payout_info['Contest Date'] == contest_date]
|
|
|
|
| 70 |
|
| 71 |
return payout_info
|
| 72 |
|
|
@@ -239,7 +240,7 @@ if selected_tab == 'Data Load':
|
|
| 239 |
st.session_state['player_info'], st.session_state['info_maps'] = grab_contest_player_info(db, sport_init, type_init, date_select, contest_name_var, contest_id_map)
|
| 240 |
st.session_state['Contest_file'] = grab_contest_data(sport_init, contest_name_var, contest_id_map, date_select, date_select2)
|
| 241 |
try:
|
| 242 |
-
st.session_state['payout_info'] = grab_contest_payout_info(db, sport_init, type_init, date_select, contest_name_var, contest_id_map)
|
| 243 |
except:
|
| 244 |
st.session_state['payout_info'] = None
|
| 245 |
else:
|
|
@@ -259,7 +260,7 @@ if selected_tab == 'Data Load':
|
|
| 259 |
except:
|
| 260 |
st.warning('Please upload a Contest CSV')
|
| 261 |
try:
|
| 262 |
-
st.session_state['payout_info'] = grab_contest_payout_info(db, sport_init, type_init, date_select, contest_name_var, contest_id_map)
|
| 263 |
except:
|
| 264 |
st.session_state['payout_info'] = None
|
| 265 |
else:
|
|
|
|
| 57 |
|
| 58 |
return player_info, info_maps
|
| 59 |
|
| 60 |
+
def grab_contest_payout_info(db, sport, type, contest_date, contest_name, contest_id_map, contest_id):
|
| 61 |
if type == 'Classic':
|
| 62 |
db_type = 'reg'
|
| 63 |
elif type == 'Showdown':
|
|
|
|
| 67 |
|
| 68 |
payout_info = pd.DataFrame(list(cursor)).drop('_id', axis=1)
|
| 69 |
payout_info = payout_info[payout_info['Contest Date'] == contest_date]
|
| 70 |
+
payout_info = payout_info[payout_info['Contest ID'] == contest_id_map[contest_name]]
|
| 71 |
|
| 72 |
return payout_info
|
| 73 |
|
|
|
|
| 240 |
st.session_state['player_info'], st.session_state['info_maps'] = grab_contest_player_info(db, sport_init, type_init, date_select, contest_name_var, contest_id_map)
|
| 241 |
st.session_state['Contest_file'] = grab_contest_data(sport_init, contest_name_var, contest_id_map, date_select, date_select2)
|
| 242 |
try:
|
| 243 |
+
st.session_state['payout_info'] = grab_contest_payout_info(db, sport_init, type_init, date_select, contest_name_var, contest_id_map, contest_id_map[contest_name_var])
|
| 244 |
except:
|
| 245 |
st.session_state['payout_info'] = None
|
| 246 |
else:
|
|
|
|
| 260 |
except:
|
| 261 |
st.warning('Please upload a Contest CSV')
|
| 262 |
try:
|
| 263 |
+
st.session_state['payout_info'] = grab_contest_payout_info(db, sport_init, type_init, date_select, contest_name_var, contest_id_map, contest_id_map[contest_name_var])
|
| 264 |
except:
|
| 265 |
st.session_state['payout_info'] = None
|
| 266 |
else:
|