James McCool
commited on
Commit
·
e8a3351
1
Parent(s):
8794602
Enhance contest data handling in app.py
Browse files- Updated the condition for accessing contest data in session state to prevent duplication frame errors.
- Ensured that the duplication frame is only processed when the contest data is available, improving application stability and user experience.
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:
|
153 |
player_columns = [col for col in st.session_state['Contest'].columns if col not in excluded_cols]
|
154 |
for col in player_columns:
|
155 |
st.session_state['Contest'][col] = st.session_state['Contest'][col].astype(str)
|
@@ -346,6 +346,7 @@ with tab2:
|
|
346 |
hide_index=True
|
347 |
)
|
348 |
|
|
|
349 |
with st.container():
|
350 |
tab1, tab2, tab3, tab4, tab5 = st.tabs(['Player Used Info', 'Stack Used Info', 'Stack Size Info', 'General Info', 'Duplication Info'])
|
351 |
with tab1:
|
@@ -492,4 +493,4 @@ with tab2:
|
|
492 |
st.dataframe(st.session_state['duplication_frame'].iloc[start_dupe_idx:end_dupe_idx].style.
|
493 |
background_gradient(cmap='RdYlGn', subset=['uniques%', 'under_5%', 'under_10%'], axis=0).
|
494 |
background_gradient(cmap='RdYlGn', subset=['uniques', 'under_5', 'under_10'], axis=0).
|
495 |
-
format(dupe_format, precision=2), hide_index=True)
|
|
|
149 |
|
150 |
with tab2:
|
151 |
excluded_cols = ['BaseName', 'EntryCount']
|
152 |
+
if 'Contest' in st.session_state and 'duplication_frame' not in st.session_state:
|
153 |
player_columns = [col for col in st.session_state['Contest'].columns if col not in excluded_cols]
|
154 |
for col in player_columns:
|
155 |
st.session_state['Contest'][col] = st.session_state['Contest'][col].astype(str)
|
|
|
346 |
hide_index=True
|
347 |
)
|
348 |
|
349 |
+
if 'Contest' in st.session_state:
|
350 |
with st.container():
|
351 |
tab1, tab2, tab3, tab4, tab5 = st.tabs(['Player Used Info', 'Stack Used Info', 'Stack Size Info', 'General Info', 'Duplication Info'])
|
352 |
with tab1:
|
|
|
493 |
st.dataframe(st.session_state['duplication_frame'].iloc[start_dupe_idx:end_dupe_idx].style.
|
494 |
background_gradient(cmap='RdYlGn', subset=['uniques%', 'under_5%', 'under_10%'], axis=0).
|
495 |
background_gradient(cmap='RdYlGn', subset=['uniques', 'under_5', 'under_10'], axis=0).
|
496 |
+
format(dupe_format, precision=2), hide_index=True)
|