Jon Solow
commited on
Commit
·
032e57e
1
Parent(s):
56d0518
Handle case of stopiteration when player id not found
Browse files
src/pages/10_Set_Your_Lineup.py
CHANGED
|
@@ -119,9 +119,13 @@ def position_cell(
|
|
| 119 |
options_list = options_map[pos_str][int(week)]
|
| 120 |
disabled = False
|
| 121 |
if isinstance(selected_id, str):
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
else:
|
| 126 |
selected_player = PlayerOption.empty_player()
|
| 127 |
selected_option_idx = 0
|
|
|
|
| 119 |
options_list = options_map[pos_str][int(week)]
|
| 120 |
disabled = False
|
| 121 |
if isinstance(selected_id, str):
|
| 122 |
+
try:
|
| 123 |
+
selected_option_idx, selected_player = next(
|
| 124 |
+
(i, v) for i, v in enumerate(options_list) if str(selected_id) == str(v.gsis_id)
|
| 125 |
+
)
|
| 126 |
+
except StopIteration:
|
| 127 |
+
selected_player = PlayerOption.empty_player()
|
| 128 |
+
selected_option_idx = 0
|
| 129 |
else:
|
| 130 |
selected_player = PlayerOption.empty_player()
|
| 131 |
selected_option_idx = 0
|