James McCool commited on
Commit
f3aa777
·
1 Parent(s): 2c1b48a

Add clear saved lineups functionality in app.py by introducing a new button to delete saved lineups from session state. This update enhances user control over saved data and improves overall user experience by providing a clearer interface for managing lineups.

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -1392,7 +1392,7 @@ with tab4:
1392
  )
1393
 
1394
  # Optionally, add a button to clear the lineup
1395
- clear_col, save_col, export_col, blank_col = st.columns([2, 2, 2, 12])
1396
  with clear_col:
1397
  if st.button("Clear Lineup", key='clear_lineup'):
1398
  st.session_state['handbuilder_lineup'] = pd.DataFrame(columns=['Player', 'Position', 'Team', 'Team_Total', 'Opp_Total', 'Salary', 'Median', '2x%', 'Own%', 'Slot', 'Order'])
@@ -1422,4 +1422,10 @@ with tab4:
1422
  if 'saved_lineups' in st.session_state:
1423
  st.table(pd.DataFrame(st.session_state['saved_lineups'], columns=dk_hb_columns if site_var == 'Draftkings' else fd_hb_columns))
1424
  else:
1425
- st.write("No saved lineups")
 
 
 
 
 
 
 
1392
  )
1393
 
1394
  # Optionally, add a button to clear the lineup
1395
+ clear_col, save_col, export_col, clear_saved_col, blank_col = st.columns([2, 2, 2, 2, 12])
1396
  with clear_col:
1397
  if st.button("Clear Lineup", key='clear_lineup'):
1398
  st.session_state['handbuilder_lineup'] = pd.DataFrame(columns=['Player', 'Position', 'Team', 'Team_Total', 'Opp_Total', 'Salary', 'Median', '2x%', 'Own%', 'Slot', 'Order'])
 
1422
  if 'saved_lineups' in st.session_state:
1423
  st.table(pd.DataFrame(st.session_state['saved_lineups'], columns=dk_hb_columns if site_var == 'Draftkings' else fd_hb_columns))
1424
  else:
1425
+ st.write("No saved lineups")
1426
+
1427
+ with clear_saved_col:
1428
+ if st.button("Clear Saved", key='clear_saved'):
1429
+ if 'saved_lineups' in st.session_state:
1430
+ del st.session_state['saved_lineups']
1431
+ st.rerun()