James McCool
commited on
Commit
·
3e52c68
1
Parent(s):
8ccc0a4
Update session state checks for contest information in app.py
Browse files- Modified the condition for checking the presence of 'display_contest_info' in session state to enhance data handling and prevent errors.
- Added a safeguard to stop execution if 'display_contest_info' is not available, improving application stability and user experience.
- Ensured that player columns are only processed when relevant contest data is present, maintaining data integrity.
app.py
CHANGED
|
@@ -149,7 +149,7 @@ with tab1:
|
|
| 149 |
|
| 150 |
with tab2:
|
| 151 |
excluded_cols = ['BaseName', 'EntryCount']
|
| 152 |
-
if 'Contest' in st.session_state and '
|
| 153 |
st.session_state['player_columns'] = [col for col in st.session_state['Contest'].columns if col not in excluded_cols]
|
| 154 |
for col in st.session_state['player_columns']:
|
| 155 |
st.session_state['Contest'][col] = st.session_state['Contest'][col].astype(str)
|
|
@@ -303,7 +303,7 @@ with tab2:
|
|
| 303 |
st.session_state['display_contest_info'] = st.session_state['display_contest_info'][mask]
|
| 304 |
if st.session_state['low_entries_var'] and st.session_state['high_entries_var']:
|
| 305 |
st.session_state['display_contest_info'] = st.session_state['display_contest_info'][st.session_state['display_contest_info']['EntryCount'].between(st.session_state['low_entries_var'], st.session_state['high_entries_var'])]
|
| 306 |
-
|
| 307 |
# Initialize pagination in session state if not exists
|
| 308 |
if 'current_page' not in st.session_state:
|
| 309 |
st.session_state.current_page = 1
|
|
@@ -346,7 +346,9 @@ with tab2:
|
|
| 346 |
use_container_width=True,
|
| 347 |
hide_index=True
|
| 348 |
)
|
| 349 |
-
|
|
|
|
|
|
|
| 350 |
if 'Contest' in st.session_state:
|
| 351 |
with st.container():
|
| 352 |
tab1, tab2, tab3, tab4, tab5 = st.tabs(['Player Used Info', 'Stack Used Info', 'Stack Size Info', 'General Info', 'Duplication Info'])
|
|
|
|
| 149 |
|
| 150 |
with tab2:
|
| 151 |
excluded_cols = ['BaseName', 'EntryCount']
|
| 152 |
+
if 'Contest' in st.session_state and 'display_contest_info' not in st.session_state:
|
| 153 |
st.session_state['player_columns'] = [col for col in st.session_state['Contest'].columns if col not in excluded_cols]
|
| 154 |
for col in st.session_state['player_columns']:
|
| 155 |
st.session_state['Contest'][col] = st.session_state['Contest'][col].astype(str)
|
|
|
|
| 303 |
st.session_state['display_contest_info'] = st.session_state['display_contest_info'][mask]
|
| 304 |
if st.session_state['low_entries_var'] and st.session_state['high_entries_var']:
|
| 305 |
st.session_state['display_contest_info'] = st.session_state['display_contest_info'][st.session_state['display_contest_info']['EntryCount'].between(st.session_state['low_entries_var'], st.session_state['high_entries_var'])]
|
| 306 |
+
if 'display_contest_info' in st.session_state:
|
| 307 |
# Initialize pagination in session state if not exists
|
| 308 |
if 'current_page' not in st.session_state:
|
| 309 |
st.session_state.current_page = 1
|
|
|
|
| 346 |
use_container_width=True,
|
| 347 |
hide_index=True
|
| 348 |
)
|
| 349 |
+
else:
|
| 350 |
+
st.stop()
|
| 351 |
+
|
| 352 |
if 'Contest' in st.session_state:
|
| 353 |
with st.container():
|
| 354 |
tab1, tab2, tab3, tab4, tab5 = st.tabs(['Player Used Info', 'Stack Used Info', 'Stack Size Info', 'General Info', 'Duplication Info'])
|