James McCool commited on
Commit
be6c88d
·
1 Parent(s): dcd9767

Initialize calc_toggle in session state if not present in app.py

Browse files

- Added a check to initialize 'calc_toggle' in session state only if it is not already set, improving session state management and ensuring consistent behavior during user interactions.

Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -18,7 +18,8 @@ from global_func.load_csv import load_csv
18
  from global_func.find_csv_mismatches import find_csv_mismatches
19
 
20
  player_exposure_format = {'Exposure Overall': '{:.2%}', 'Exposure Top 1%': '{:.2%}', 'Exposure Top 5%': '{:.2%}', 'Exposure Top 10%': '{:.2%}', 'Exposure Top 20%': '{:.2%}'}
21
- st.session_state['calc_toggle'] = False
 
22
 
23
  tab1, tab2 = st.tabs(["Data Load", "Contest Analysis"])
24
  with tab1:
@@ -121,7 +122,6 @@ with tab2:
121
  # Apply entry name filter if specific entries are selected
122
  if entry_parse_var == 'Specific' and entry_names:
123
  working_df = working_df[working_df['BaseName'].isin(entry_names)]
124
- st.session_state['calc_toggle'] = True
125
 
126
  if type_var == 'Classic':
127
  working_df['stack'] = working_df.apply(
 
18
  from global_func.find_csv_mismatches import find_csv_mismatches
19
 
20
  player_exposure_format = {'Exposure Overall': '{:.2%}', 'Exposure Top 1%': '{:.2%}', 'Exposure Top 5%': '{:.2%}', 'Exposure Top 10%': '{:.2%}', 'Exposure Top 20%': '{:.2%}'}
21
+ if 'calc_toggle' not in st.session_state:
22
+ st.session_state['calc_toggle'] = False
23
 
24
  tab1, tab2 = st.tabs(["Data Load", "Contest Analysis"])
25
  with tab1:
 
122
  # Apply entry name filter if specific entries are selected
123
  if entry_parse_var == 'Specific' and entry_names:
124
  working_df = working_df[working_df['BaseName'].isin(entry_names)]
 
125
 
126
  if type_var == 'Classic':
127
  working_df['stack'] = working_df.apply(