James McCool
commited on
Commit
·
a34bb65
1
Parent(s):
a4cf167
Refactor contest data loading logic in app.py to improve session state checks
Browse files- Updated the logic for loading contest data to ensure the 'Load Contest Data' button only appears when 'Contest_file' is not already in session state, enhancing user experience and preventing redundant actions.
- Maintained existing checks for 'Adj_Contest' to ensure data integrity during the loading process.
app.py
CHANGED
@@ -72,9 +72,12 @@ with tab1:
|
|
72 |
if 'Contest' in st.session_state:
|
73 |
del st.session_state['Contest']
|
74 |
if parse_type == 'DB Search':
|
75 |
-
if
|
76 |
-
st.
|
77 |
-
|
|
|
|
|
|
|
78 |
if 'Contest_file' not in st.session_state and 'Adj_Contest' not in st.session_state:
|
79 |
st.session_state['Contest'], st.session_state['ownership_df'], st.session_state['actual_df'], st.session_state['entry_list'] = load_contest_file(st.session_state['Contest_file'], sport_select)
|
80 |
st.session_state['Contest'] = st.session_state['Contest'].dropna(how='all')
|
|
|
72 |
if 'Contest' in st.session_state:
|
73 |
del st.session_state['Contest']
|
74 |
if parse_type == 'DB Search':
|
75 |
+
if 'Contest_file' not in st.session_state:
|
76 |
+
if st.button('Load Contest Data', key='load_contest_data'):
|
77 |
+
st.session_state['Contest_file'] = grab_contest_data('MLB', contest_name_var, contest_id_map, contest_date_map)
|
78 |
+
else:
|
79 |
+
pass
|
80 |
+
|
81 |
if 'Contest_file' not in st.session_state and 'Adj_Contest' not in st.session_state:
|
82 |
st.session_state['Contest'], st.session_state['ownership_df'], st.session_state['actual_df'], st.session_state['entry_list'] = load_contest_file(st.session_state['Contest_file'], sport_select)
|
83 |
st.session_state['Contest'] = st.session_state['Contest'].dropna(how='all')
|