Update app.py
Browse files
app.py
CHANGED
|
@@ -335,14 +335,20 @@ def server(input, output, session):
|
|
| 335 |
return df
|
| 336 |
|
| 337 |
@render.ui
|
| 338 |
-
@reactive.event(input.player_button, input.
|
| 339 |
def player_select_ui():
|
| 340 |
# Get the list of pitchers for the selected level and season
|
| 341 |
-
df_pitcher_info = scrape.get_players(sport_id=int(input.level_input()), season=int(input.year_input())).filter(
|
| 342 |
-
pl.col("position").is_in(['P']))
|
|
|
|
|
|
|
|
|
|
| 343 |
|
| 344 |
# Create a dictionary of pitcher IDs and names
|
| 345 |
pitcher_dict = dict(zip(df_pitcher_info['player_id'], df_pitcher_info['name']))
|
|
|
|
|
|
|
|
|
|
| 346 |
|
| 347 |
# Return a select input for choosing a pitcher
|
| 348 |
return ui.input_select("pitcher_id", "Select Pitcher", pitcher_dict, selectize=True)
|
|
|
|
| 335 |
return df
|
| 336 |
|
| 337 |
@render.ui
|
| 338 |
+
@reactive.event(input.player_button, input.year_input, input.level_input, input.type_input,ignore_none=False)
|
| 339 |
def player_select_ui():
|
| 340 |
# Get the list of pitchers for the selected level and season
|
| 341 |
+
df_pitcher_info = scrape.get_players(sport_id=int(input.level_input()), season=int(input.year_input()), game_type = [input.type_input()]).filter(
|
| 342 |
+
(pl.col("position").is_in(['P','TWP']))|
|
| 343 |
+
(pl.col("player_id").is_in([686846]))
|
| 344 |
+
|
| 345 |
+
).sort("name")
|
| 346 |
|
| 347 |
# Create a dictionary of pitcher IDs and names
|
| 348 |
pitcher_dict = dict(zip(df_pitcher_info['player_id'], df_pitcher_info['name']))
|
| 349 |
+
|
| 350 |
+
|
| 351 |
+
|
| 352 |
|
| 353 |
# Return a select input for choosing a pitcher
|
| 354 |
return ui.input_select("pitcher_id", "Select Pitcher", pitcher_dict, selectize=True)
|