James McCool
commited on
Commit
·
e22fb4e
1
Parent(s):
353cf78
Update contest session state handling in app.py to improve data integrity
Browse files- Added a condition to delete the 'Contest' entry from session state if it is empty after checking for 'Backtesting_upload', enhancing the robustness of data management.
- This change aims to prevent potential errors related to empty contest data and ensures that only valid contest information is retained in the session state.
app.py
CHANGED
@@ -192,6 +192,11 @@ with tab1:
|
|
192 |
st.session_state['portfolio_df']['EntryCount'] = len(st.session_state['portfolio_df'])
|
193 |
|
194 |
st.session_state['portfolio_df'] = st.session_state['portfolio_df'][['BaseName', 'EntryCount'] + original_columns]
|
|
|
|
|
|
|
|
|
|
|
195 |
except:
|
196 |
st.session_state['portfolio_df'] = None
|
197 |
|
@@ -250,7 +255,6 @@ with tab2:
|
|
250 |
'own_percent_rank': dict(zip(st.session_state['ownership_df']['Player'], st.session_state['ownership_df']['Own'].rank(pct=True)))
|
251 |
}
|
252 |
|
253 |
-
|
254 |
working_df = st.session_state['Contest'].copy()
|
255 |
|
256 |
# Pre-compute lookup arrays for vectorized operations
|
|
|
192 |
st.session_state['portfolio_df']['EntryCount'] = len(st.session_state['portfolio_df'])
|
193 |
|
194 |
st.session_state['portfolio_df'] = st.session_state['portfolio_df'][['BaseName', 'EntryCount'] + original_columns]
|
195 |
+
|
196 |
+
if 'Contest' in st.session_state and st.session_state['Contest'][st.session_state['Contest']['BaseName'] == 'Backtesting_upload'].empty:
|
197 |
+
del st.session_state['Contest']
|
198 |
+
else:
|
199 |
+
pass
|
200 |
except:
|
201 |
st.session_state['portfolio_df'] = None
|
202 |
|
|
|
255 |
'own_percent_rank': dict(zip(st.session_state['ownership_df']['Player'], st.session_state['ownership_df']['Own'].rank(pct=True)))
|
256 |
}
|
257 |
|
|
|
258 |
working_df = st.session_state['Contest'].copy()
|
259 |
|
260 |
# Pre-compute lookup arrays for vectorized operations
|