Jon Solow
commited on
Commit
·
2d08297
1
Parent(s):
3a2866a
Prevent selection of players in games that started
Browse files
src/pages/10_Set_Your_Lineup.py
CHANGED
|
@@ -129,7 +129,7 @@ def position_cell(
|
|
| 129 |
options = [selected_player]
|
| 130 |
selected_option_idx = 0
|
| 131 |
else:
|
| 132 |
-
options = options_list
|
| 133 |
|
| 134 |
selected_player_from_box = st.selectbox(
|
| 135 |
pos_str,
|
|
@@ -140,8 +140,12 @@ def position_cell(
|
|
| 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:
|
| 143 |
-
|
| 144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
|
| 146 |
|
| 147 |
def update_and_save_selection(pos_label: str, selection_id: str, existing_selection_map):
|
|
|
|
| 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 |
|
| 134 |
selected_player_from_box = st.selectbox(
|
| 135 |
pos_str,
|
|
|
|
| 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:
|
| 143 |
+
if selected_player_from_box.is_locked():
|
| 144 |
+
st.warning("Sorry player's game has already started", icon="🚨")
|
| 145 |
+
return
|
| 146 |
+
else:
|
| 147 |
+
update_and_save_selection(pos_label, selected_player_from_box.gsis_id, existing_selection_map),
|
| 148 |
+
display_player(selected_player)
|
| 149 |
|
| 150 |
|
| 151 |
def update_and_save_selection(pos_label: str, selection_id: str, existing_selection_map):
|