James McCool commited on
Commit
14771cd
·
1 Parent(s): 11b09bf

Add reset functionality for portfolio in app.py: store original portfolio state and implement reset button to restore it, enhancing user experience during trimming options.

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -683,6 +683,7 @@ with tab2:
683
 
684
  with tab3:
685
  if 'portfolio' in st.session_state and 'projections_df' in st.session_state:
 
686
 
687
  excluded_cols = ['salary', 'median', 'Own', 'Finish_percentile', 'Dupes', 'Stack', 'Win%', 'Lineup Edge']
688
  with st.container():
@@ -801,6 +802,8 @@ with tab3:
801
 
802
  submitted = st.form_submit_button("Submit")
803
  with st.expander('Trimming Options'):
 
 
804
  with st.form(key='trim_form'):
805
  performance_type = st.selectbox("Select sort type", ['median', 'Finish_percentile'])
806
  own_type = st.selectbox("Select trimming variable type", ['Own', 'Product Own'])
 
683
 
684
  with tab3:
685
  if 'portfolio' in st.session_state and 'projections_df' in st.session_state:
686
+ st.session_state['origin_portfolio'] = st.session_state['portfolio'].copy()
687
 
688
  excluded_cols = ['salary', 'median', 'Own', 'Finish_percentile', 'Dupes', 'Stack', 'Win%', 'Lineup Edge']
689
  with st.container():
 
802
 
803
  submitted = st.form_submit_button("Submit")
804
  with st.expander('Trimming Options'):
805
+ with st.button('Reset Portfolio'):
806
+ st.session_state['portfolio'] = st.session_state['origin_portfolio'].copy()
807
  with st.form(key='trim_form'):
808
  performance_type = st.selectbox("Select sort type", ['median', 'Finish_percentile'])
809
  own_type = st.selectbox("Select trimming variable type", ['Own', 'Product Own'])