Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -740,6 +740,25 @@ def sort_scoreboard_games(df: pd.DataFrame) -> pd.DataFrame:
|
|
| 740 |
|
| 741 |
return out.drop(columns=["status_group", "status_rank"], errors="ignore")
|
| 742 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 743 |
def render_dashboard() -> None:
|
| 744 |
st.subheader("WBC Live Dashboard")
|
| 745 |
st.caption("Professional scoreboard view")
|
|
@@ -776,12 +795,14 @@ def render_dashboard() -> None:
|
|
| 776 |
final_games = sort_scoreboard_games(normalize_game_cards_df(final_games))
|
| 777 |
scheduled_games = sort_scoreboard_games(normalize_game_cards_df(scheduled_games))
|
| 778 |
|
|
|
|
|
|
|
| 779 |
if filter_option == "All":
|
| 780 |
-
|
| 781 |
render_scoreboard_section("FINAL", final_games)
|
| 782 |
render_scoreboard_section("UPCOMING", scheduled_games)
|
| 783 |
elif filter_option == "Live":
|
| 784 |
-
|
| 785 |
elif filter_option == "Final":
|
| 786 |
render_scoreboard_section("FINAL", final_games)
|
| 787 |
else:
|
|
|
|
| 740 |
|
| 741 |
return out.drop(columns=["status_group", "status_rank"], errors="ignore")
|
| 742 |
|
| 743 |
+
def render_live_games_with_edge_strips(
|
| 744 |
+
live_games: pd.DataFrame,
|
| 745 |
+
statcast_df: pd.DataFrame,
|
| 746 |
+
odds_df: pd.DataFrame | None = None,
|
| 747 |
+
) -> None:
|
| 748 |
+
if live_games.empty:
|
| 749 |
+
return
|
| 750 |
+
|
| 751 |
+
st.markdown('<div class="section-title">LIVE GAMES</div>', unsafe_allow_html=True)
|
| 752 |
+
|
| 753 |
+
games = live_games.to_dict("records")
|
| 754 |
+
cols = st.columns(2)
|
| 755 |
+
|
| 756 |
+
for i, game in enumerate(games):
|
| 757 |
+
with cols[i % 2]:
|
| 758 |
+
render_game_card(game)
|
| 759 |
+
edge = compute_live_edge_stub(game, statcast_df=statcast_df, odds_df=odds_df)
|
| 760 |
+
render_live_edge_strip(edge)
|
| 761 |
+
|
| 762 |
def render_dashboard() -> None:
|
| 763 |
st.subheader("WBC Live Dashboard")
|
| 764 |
st.caption("Professional scoreboard view")
|
|
|
|
| 795 |
final_games = sort_scoreboard_games(normalize_game_cards_df(final_games))
|
| 796 |
scheduled_games = sort_scoreboard_games(normalize_game_cards_df(scheduled_games))
|
| 797 |
|
| 798 |
+
odds_df = load_odds()
|
| 799 |
+
|
| 800 |
if filter_option == "All":
|
| 801 |
+
render_live_games_with_edge_strips(live_games, statcast_df=statcast_df, odds_df=odds_df)
|
| 802 |
render_scoreboard_section("FINAL", final_games)
|
| 803 |
render_scoreboard_section("UPCOMING", scheduled_games)
|
| 804 |
elif filter_option == "Live":
|
| 805 |
+
render_live_games_with_edge_strips(live_games, statcast_df=statcast_df, odds_df=odds_df)
|
| 806 |
elif filter_option == "Final":
|
| 807 |
render_scoreboard_section("FINAL", final_games)
|
| 808 |
else:
|