James McCool commited on
Commit
f543677
·
1 Parent(s): 910ce9f

Refactor contest selection process in app.py to streamline user input

Browse files

- Adjusted the layout by removing the game options column and integrating game type selection directly with sport selection.
- Updated the grab_contest_names function call to include the selected game type, enhancing the flexibility of contest data retrieval.
- Maintained existing functionality while improving the user interface for contest selection.

Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -57,12 +57,13 @@ with tab1:
57
  with col1:
58
  if st.button('Clear data', key='reset1'):
59
  st.session_state.clear()
60
- search_options, sport_options, date_options, game_options = st.columns(4)
61
  with search_options:
62
  parse_type = st.selectbox("Manual upload or DB search?", ['DB Search', 'Manual'], key='parse_type')
63
  with sport_options:
64
  sport_select = st.selectbox("Select Sport", ['MLB', 'MMA', 'GOLF'], key='sport_select')
65
- contest_names, contest_id_map, curr_info = grab_contest_names(db, sport_select)
 
66
 
67
  with date_options:
68
  date_list = curr_info['Date'].sort_values(ascending=False).unique()
@@ -73,8 +74,6 @@ with tab1:
73
  name_parse = curr_info[curr_info['Date'] == date_select]['Contest Name'].reset_index(drop=True)
74
  date_select = date_select.replace('-', '')
75
  date_select2 = date_select2.replace('-', '')
76
- with game_options:
77
- type_var = st.selectbox("Select Game Type", ['Classic', 'Showdown'], key='type_var')
78
 
79
  contest_name_var = st.selectbox("Select Contest to load", name_parse)
80
  if parse_type == 'DB Search':
 
57
  with col1:
58
  if st.button('Clear data', key='reset1'):
59
  st.session_state.clear()
60
+ search_options, sport_options, date_options = st.columns(3)
61
  with search_options:
62
  parse_type = st.selectbox("Manual upload or DB search?", ['DB Search', 'Manual'], key='parse_type')
63
  with sport_options:
64
  sport_select = st.selectbox("Select Sport", ['MLB', 'MMA', 'GOLF'], key='sport_select')
65
+ type_var = st.selectbox("Select Game Type", ['Classic', 'Showdown'], key='type_var')
66
+ contest_names, contest_id_map, curr_info = grab_contest_names(db, sport_select, type_var)
67
 
68
  with date_options:
69
  date_list = curr_info['Date'].sort_values(ascending=False).unique()
 
74
  name_parse = curr_info[curr_info['Date'] == date_select]['Contest Name'].reset_index(drop=True)
75
  date_select = date_select.replace('-', '')
76
  date_select2 = date_select2.replace('-', '')
 
 
77
 
78
  contest_name_var = st.selectbox("Select Contest to load", name_parse)
79
  if parse_type == 'DB Search':