James McCool commited on
Commit
517ef17
·
1 Parent(s): 57a5f25

Update portfolio reset functionality in app.py to restore working frame from base frame. This change ensures that the portfolio resets correctly by copying the base frame, enhancing the user experience during portfolio management.

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -810,7 +810,7 @@ with tab2:
810
  col1, col2 = st.columns(2)
811
  with col1:
812
  if st.button('Reset Portfolio', key='reset_port'):
813
- del st.session_state['working_frame']
814
 
815
  with col2:
816
  with st.form(key='contest_size_form'):
@@ -942,7 +942,8 @@ with tab2:
942
  sum(st.session_state['map_dict']['own_map'].get(player, 0) for player in row.iloc[1:]),
943
  axis=1
944
  )
945
- st.session_state['working_frame'] = predict_dupes(st.session_state['working_frame'], st.session_state['map_dict'], site_var, type_var, Contest_Size, strength_var, sport_var)
 
946
  # st.session_state['highest_owned_teams'] = st.session_state['projections_df'][~st.session_state['projections_df']['position'].isin(['P', 'SP'])].groupby('team')['ownership'].sum().sort_values(ascending=False).head(3).index.tolist()
947
  # st.session_state['highest_owned_pitchers'] = st.session_state['projections_df'][st.session_state['projections_df']['position'].isin(['P', 'SP'])]['player_names'].sort_values(by='ownership', ascending=False).head(3).tolist()
948
  if 'info_columns_dict' not in st.session_state:
 
810
  col1, col2 = st.columns(2)
811
  with col1:
812
  if st.button('Reset Portfolio', key='reset_port'):
813
+ st.session_state['working_frame'] = st.session_state['base_frame'].copy()
814
 
815
  with col2:
816
  with st.form(key='contest_size_form'):
 
942
  sum(st.session_state['map_dict']['own_map'].get(player, 0) for player in row.iloc[1:]),
943
  axis=1
944
  )
945
+ st.session_state['base_frame'] = predict_dupes(st.session_state['working_frame'], st.session_state['map_dict'], site_var, type_var, Contest_Size, strength_var, sport_var)
946
+ st.session_state['working_frame'] = st.session_state['base_frame'].copy()
947
  # st.session_state['highest_owned_teams'] = st.session_state['projections_df'][~st.session_state['projections_df']['position'].isin(['P', 'SP'])].groupby('team')['ownership'].sum().sort_values(ascending=False).head(3).index.tolist()
948
  # st.session_state['highest_owned_pitchers'] = st.session_state['projections_df'][st.session_state['projections_df']['position'].isin(['P', 'SP'])]['player_names'].sort_values(by='ownership', ascending=False).head(3).tolist()
949
  if 'info_columns_dict' not in st.session_state: