James McCool commited on
Commit
51b03c3
·
1 Parent(s): f0e4b10

Refactor export handling in app.py: simplify the initialization of the export_merge session state variable by removing the conditional check, ensuring it always reflects the current portfolio state for accurate export operations.

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -982,6 +982,7 @@ with tab2:
982
 
983
  st.session_state['portfolio'] = trim_portfolio(st.session_state['portfolio'], trim_slack_var, performance_type, own_type, performance_threshold_high, performance_threshold_low, own_threshold_high, own_threshold_low)
984
  st.session_state['portfolio'] = st.session_state['portfolio'].sort_values(by='median', ascending=False)
 
985
 
986
  with col2:
987
  st.session_state['portfolio'] = predict_dupes(st.session_state['portfolio'], map_dict, site_var, type_var, Contest_Size, strength_var, sport_var)
@@ -1022,8 +1023,7 @@ with tab2:
1022
  )
1023
  st.session_state['portfolio'] = st.session_state['portfolio'][lock_mask]
1024
  st.session_state['portfolio'] = st.session_state['portfolio'].sort_values(by='median', ascending=False)
1025
- if 'export_merge' not in st.session_state:
1026
- st.session_state['export_merge'] = st.session_state['portfolio'].copy()
1027
  with st.expander("Download options"):
1028
  if stack_dict is not None:
1029
  download_type = st.selectbox("Simple or Advanced Download?", options=['Simple', 'Advanced'], key='download_choice')
 
982
 
983
  st.session_state['portfolio'] = trim_portfolio(st.session_state['portfolio'], trim_slack_var, performance_type, own_type, performance_threshold_high, performance_threshold_low, own_threshold_high, own_threshold_low)
984
  st.session_state['portfolio'] = st.session_state['portfolio'].sort_values(by='median', ascending=False)
985
+ st.session_state['export_merge'] = st.session_state['portfolio'].copy()
986
 
987
  with col2:
988
  st.session_state['portfolio'] = predict_dupes(st.session_state['portfolio'], map_dict, site_var, type_var, Contest_Size, strength_var, sport_var)
 
1023
  )
1024
  st.session_state['portfolio'] = st.session_state['portfolio'][lock_mask]
1025
  st.session_state['portfolio'] = st.session_state['portfolio'].sort_values(by='median', ascending=False)
1026
+ st.session_state['export_merge'] = st.session_state['portfolio'].copy()
 
1027
  with st.expander("Download options"):
1028
  if stack_dict is not None:
1029
  download_type = st.selectbox("Simple or Advanced Download?", options=['Simple', 'Advanced'], key='download_choice')