James McCool commited on
Commit
4fdebbd
·
1 Parent(s): 2e2d30e

Update portfolio loading logic to ensure 'portfolio_loaded' state is only set to False when no portfolio file is present in session state. This change enhances the clarity of the loading process and maintains data integrity during uploads.

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -560,7 +560,8 @@ if selected_tab == 'Data Load':
560
  st.info("Go ahead and upload a portfolio file here. Only include player columns.")
561
 
562
  upload_toggle = st.selectbox("What source are you uploading from?", options=['Paydirt DB', 'SaberSim (Just IDs)', 'Draftkings/Fanduel (Names + IDs)', 'Other (Just Names)'])
563
- st.session_state['portfolio_loaded'] = False
 
564
  if upload_toggle == 'Paydirt DB':
565
  if st.button("Load from Database after inserting site CSV"):
566
  if site_var == 'Draftkings':
@@ -579,7 +580,7 @@ if selected_tab == 'Data Load':
579
  del st.session_state['portfolio']
580
  if 'export_portfolio' in st.session_state:
581
  del st.session_state['export_portfolio']
582
-
583
  elif 'db_portfolio_file' in st.session_state:
584
  st.session_state['portfolio_loaded'] = True
585
 
 
560
  st.info("Go ahead and upload a portfolio file here. Only include player columns.")
561
 
562
  upload_toggle = st.selectbox("What source are you uploading from?", options=['Paydirt DB', 'SaberSim (Just IDs)', 'Draftkings/Fanduel (Names + IDs)', 'Other (Just Names)'])
563
+ if 'portfolio' not in st.session_state:
564
+ st.session_state['portfolio_loaded'] = False
565
  if upload_toggle == 'Paydirt DB':
566
  if st.button("Load from Database after inserting site CSV"):
567
  if site_var == 'Draftkings':
 
580
  del st.session_state['portfolio']
581
  if 'export_portfolio' in st.session_state:
582
  del st.session_state['export_portfolio']
583
+
584
  elif 'db_portfolio_file' in st.session_state:
585
  st.session_state['portfolio_loaded'] = True
586