James McCool commited on
Commit
5cebc76
·
1 Parent(s): 3eaf989

Clear session state before loading contest data in app.py

Browse files

- Added logic to clear the session state when selecting a contest to load, ensuring a fresh start for data processing.
- Improved user experience by preventing potential conflicts with previously loaded contest data during uploads.

Files changed (1) hide show
  1. app.py +1 -0
app.py CHANGED
@@ -72,6 +72,7 @@ with tab1:
72
  st.info("Go ahead and upload a Contest file here. Only include player columns and an optional 'Stack' column if you are playing MLB.")
73
  if parse_type == 'DB Search':
74
  contest_name_var = st.selectbox("Select Contest to load", name_parse)
 
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(sport_select, contest_name_var, contest_id_map, date_select)
 
72
  st.info("Go ahead and upload a Contest file here. Only include player columns and an optional 'Stack' column if you are playing MLB.")
73
  if parse_type == 'DB Search':
74
  contest_name_var = st.selectbox("Select Contest to load", name_parse)
75
+ st.session_state.clear()
76
  if 'Contest_file' not in st.session_state:
77
  if st.button('Load Contest Data', key='load_contest_data'):
78
  st.session_state['Contest_file'] = grab_contest_data(sport_select, contest_name_var, contest_id_map, date_select)