James McCool commited on
Commit
4088be2
·
1 Parent(s): 25ae890

Refactor contest size and strength input in app.py: replace individual input fields with a form layout for better organization and user experience, and ensure portfolio reset functionality is maintained upon submission.

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -796,16 +796,22 @@ with tab1:
796
  with tab2:
797
  if 'portfolio' in st.session_state and 'projections_df' in st.session_state:
798
  with st.container():
799
- col1, col2, col3 = st.columns(3)
800
  with col1:
801
  if st.button('Reset Portfolio', key='reset_port'):
802
  del st.session_state['working_frame']
803
 
804
  with col2:
805
- Contest_Size = st.number_input("Enter Contest Size", value=25000, min_value=1, step=1)
806
-
807
- with col3:
808
- strength_var = st.selectbox("Select field strength", ['Average', 'Sharp', 'Weak'])
 
 
 
 
 
 
809
 
810
  excluded_cols = ['salary', 'median', 'Own', 'Finish_percentile', 'Dupes', 'Stack', 'Win%', 'Lineup Edge', 'Weighted Own', 'Geomean']
811
 
 
796
  with tab2:
797
  if 'portfolio' in st.session_state and 'projections_df' in st.session_state:
798
  with st.container():
799
+ col1, col2 = st.columns(3)
800
  with col1:
801
  if st.button('Reset Portfolio', key='reset_port'):
802
  del st.session_state['working_frame']
803
 
804
  with col2:
805
+ with st.form(key='contest_size_form'):
806
+ size_col, strength_col, submit_col = st.columns(3)
807
+ with size_col:
808
+ Contest_Size = st.number_input("Enter Contest Size", value=25000, min_value=1, step=1)
809
+ with strength_col:
810
+ strength_var = st.selectbox("Select field strength", ['Average', 'Sharp', 'Weak'])
811
+ with submit_col:
812
+ submitted = st.form_submit_button("Submit Size/Strength")
813
+ if submitted:
814
+ del st.session_state['working_frame']
815
 
816
  excluded_cols = ['salary', 'median', 'Own', 'Finish_percentile', 'Dupes', 'Stack', 'Win%', 'Lineup Edge', 'Weighted Own', 'Geomean']
817