James McCool commited on
Commit
9c4ce64
·
1 Parent(s): 9caa087

Refactor app.py to improve conditional checks for session state data. Updated rendering logic to ensure that player summaries, overall simulations, individual game data, and opponent boosts are only displayed when the corresponding data is available. This change enhances user experience by preventing errors and improving clarity during simulations.

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -692,11 +692,11 @@ if st.button("Run"):
692
 
693
  tab1, tab2, tab3 = st.tabs(["Overall Data", "Individual Game Data", "Opponent Data"])
694
  with tab1:
695
- if st.session_state.player_summary is not None:
696
  st.subheader("Full Match Data")
697
  st.dataframe(st.session_state.player_summary.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(display_formats, precision=2), use_container_width = True)
698
 
699
- if st.session_state.overall_sim_df is not None:
700
  st.subheader("Overall Simulations")
701
  stat_tabs = st.tabs(["Kills", "Deaths", "Assists", "CS"])
702
 
@@ -747,11 +747,11 @@ with tab1:
747
  )
748
 
749
  with tab2:
750
- if st.session_state.team_data is not None:
751
  st.subheader("Individual Game Data")
752
  st.dataframe(st.session_state.team_data.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(display_formats, precision=2), use_container_width = True)
753
 
754
- if st.session_state.sim_df is not None:
755
  st.subheader("Individual Game Simulations")
756
  unique_players = st.session_state.sim_df['Player'].unique().tolist()
757
  player_tabs = st.tabs(unique_players)
@@ -767,6 +767,6 @@ with tab2:
767
  )
768
 
769
  with tab3:
770
- if st.session_state.opp_boost is not None:
771
  st.subheader("Opponent Boosts")
772
  st.dataframe(st.session_state.opp_boost.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
 
692
 
693
  tab1, tab2, tab3 = st.tabs(["Overall Data", "Individual Game Data", "Opponent Data"])
694
  with tab1:
695
+ if 'player_summary' not in st.session_state:
696
  st.subheader("Full Match Data")
697
  st.dataframe(st.session_state.player_summary.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(display_formats, precision=2), use_container_width = True)
698
 
699
+ if 'overall_sim_df' not in st.session_state:
700
  st.subheader("Overall Simulations")
701
  stat_tabs = st.tabs(["Kills", "Deaths", "Assists", "CS"])
702
 
 
747
  )
748
 
749
  with tab2:
750
+ if 'team_data' not in st.session_state:
751
  st.subheader("Individual Game Data")
752
  st.dataframe(st.session_state.team_data.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(display_formats, precision=2), use_container_width = True)
753
 
754
+ if 'sim_df' not in st.session_state:
755
  st.subheader("Individual Game Simulations")
756
  unique_players = st.session_state.sim_df['Player'].unique().tolist()
757
  player_tabs = st.tabs(unique_players)
 
767
  )
768
 
769
  with tab3:
770
+ if 'opp_boost' not in st.session_state:
771
  st.subheader("Opponent Boosts")
772
  st.dataframe(st.session_state.opp_boost.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)