Jon Solow commited on
Commit
535ec3b
1 Parent(s): c1ae968

Set selection to disabled when not an option

Browse files
Files changed (1) hide show
  1. src/pages/10_Set_Your_Lineup.py +4 -0
src/pages/10_Set_Your_Lineup.py CHANGED
@@ -115,6 +115,7 @@ def position_cell(
115
  pos_label = f"{week}-{pos_str}-{pos_idx}"
116
  selected_id = existing_selection_map.get(pos_label)
117
  options_list = options_map[pos_str][int(week)]
 
118
  if isinstance(selected_id, str):
119
  selected_option_idx, selected_player = next(
120
  (i, v) for i, v in enumerate(options_list) if str(selected_id) == str(v.gsis_id)
@@ -125,9 +126,11 @@ def position_cell(
125
  if int(week) > CURRENT_PLAYOFF_WEEK:
126
  options = []
127
  selected_option_idx = 0
 
128
  elif int(week) < CURRENT_PLAYOFF_WEEK or selected_player.is_locked():
129
  options = [selected_player]
130
  selected_option_idx = 0
 
131
  else:
132
  options = [x for x in options_list if not x.is_locked()]
133
 
@@ -137,6 +140,7 @@ def position_cell(
137
  format_func=format_player_option,
138
  index=selected_option_idx,
139
  key=pos_label,
 
140
  )
141
  if selected_player_from_box and int(week) == CURRENT_PLAYOFF_WEEK:
142
  if selected_player_from_box.gsis_id and selected_player_from_box.gsis_id != selected_id:
 
115
  pos_label = f"{week}-{pos_str}-{pos_idx}"
116
  selected_id = existing_selection_map.get(pos_label)
117
  options_list = options_map[pos_str][int(week)]
118
+ disabled = False
119
  if isinstance(selected_id, str):
120
  selected_option_idx, selected_player = next(
121
  (i, v) for i, v in enumerate(options_list) if str(selected_id) == str(v.gsis_id)
 
126
  if int(week) > CURRENT_PLAYOFF_WEEK:
127
  options = []
128
  selected_option_idx = 0
129
+ disabled = True
130
  elif int(week) < CURRENT_PLAYOFF_WEEK or selected_player.is_locked():
131
  options = [selected_player]
132
  selected_option_idx = 0
133
+ disabled = True
134
  else:
135
  options = [x for x in options_list if not x.is_locked()]
136
 
 
140
  format_func=format_player_option,
141
  index=selected_option_idx,
142
  key=pos_label,
143
+ disabled=disabled,
144
  )
145
  if selected_player_from_box and int(week) == CURRENT_PLAYOFF_WEEK:
146
  if selected_player_from_box.gsis_id and selected_player_from_box.gsis_id != selected_id: