James McCool
commited on
Commit
·
e3e4a8e
1
Parent(s):
7de18e9
Refactor contest selection logic in app.py for improved data handling
Browse files- Updated the contest selection dropdown to utilize a parsed variable for contest names based on the selected date, enhancing clarity and user experience.
- This change aligns with ongoing efforts to streamline data retrieval processes and improve the overall functionality of the application.
app.py
CHANGED
@@ -57,8 +57,10 @@ with tab1:
|
|
57 |
with col2:
|
58 |
sport_select = st.selectbox("Select Sport", ['MLB', 'NBA', 'NFL'], key='sport_select')
|
59 |
contest_names, contest_id_map, contest_date_map, curr_info = grab_contest_names(db, sport_select)
|
|
|
60 |
with col3:
|
61 |
date_select = st.selectbox("Select Date", contest_date_map.values(), key='date_select')
|
|
|
62 |
with col4:
|
63 |
type_var = st.selectbox("Select Game Type", ['Classic', 'Showdown'], key='type_var')
|
64 |
# Add file uploaders to your app
|
@@ -68,7 +70,7 @@ with tab1:
|
|
68 |
st.subheader("Contest File")
|
69 |
st.info("Go ahead and upload a Contest file here. Only include player columns and an optional 'Stack' column if you are playing MLB.")
|
70 |
if parse_type == 'DB Search':
|
71 |
-
contest_name_var = st.selectbox("Select Contest to load",
|
72 |
if 'Contest_file' not in st.session_state:
|
73 |
if st.button('Load Contest Data', key='load_contest_data'):
|
74 |
st.session_state['Contest_file'] = grab_contest_data(sport_select, contest_name_var, contest_id_map, contest_date_map)
|
|
|
57 |
with col2:
|
58 |
sport_select = st.selectbox("Select Sport", ['MLB', 'NBA', 'NFL'], key='sport_select')
|
59 |
contest_names, contest_id_map, contest_date_map, curr_info = grab_contest_names(db, sport_select)
|
60 |
+
|
61 |
with col3:
|
62 |
date_select = st.selectbox("Select Date", contest_date_map.values(), key='date_select')
|
63 |
+
name_parse = curr_info[curr_info['Date'] == date_select]['Contest Name']
|
64 |
with col4:
|
65 |
type_var = st.selectbox("Select Game Type", ['Classic', 'Showdown'], key='type_var')
|
66 |
# Add file uploaders to your app
|
|
|
70 |
st.subheader("Contest File")
|
71 |
st.info("Go ahead and upload a Contest file here. Only include player columns and an optional 'Stack' column if you are playing MLB.")
|
72 |
if parse_type == 'DB Search':
|
73 |
+
contest_name_var = st.selectbox("Select Contest to load", name_parse)
|
74 |
if 'Contest_file' not in st.session_state:
|
75 |
if st.button('Load Contest Data', key='load_contest_data'):
|
76 |
st.session_state['Contest_file'] = grab_contest_data(sport_select, contest_name_var, contest_id_map, contest_date_map)
|