{% extends "base.html" %} {% block content %}
Season Overview Standings Schedule Playoffs
{% if active_tab == 'overview' %}

{{ season_info.name }} - Overview

Total Games (Per Team): {{ season_info.total_games }}

Games Per Week: {{ season_info.games_per_week }}

Season Start: {{ season_info.start_date }}

Season End: {{ season_info.end_date }}

{% if season_info.total_games %}

Playoff Teams: {{ season_info.playoff_teams }}

{% endif %}

Status: {{ season_info.status }} {% if season_info.is_finished %}(Finished){% else %}(In Progress){% endif %}

{% if season_info.is_finished %}

Final Standings

{% if standings %} {% for row in standings %} {% endfor %}
{{ loop.index }}. {{ row.team_name }} {{ row.wins }} - {{ row.losses }}
{% else %}

No teams enrolled.

{% endif %} {% else %}

League Action

The season is currently active or upcoming.

{% if current_user.is_authenticated and not current_user.is_admin %} {% if user_season_status == 'Approved' %}

You are currently enrolled in this season.

{% elif user_season_status == 'Pending' %}

Your request to join is pending approval.

{% else %}
{% endif %} {% elif not current_user.is_authenticated %}

Login to apply for this season.

{% endif %} {% endif %}
{% elif active_tab == 'standings' %}

{{ season_info.name }} - Standings

{% if standings %} {% for row in standings %} {% set is_my_team = current_user.is_authenticated and current_user.id|string == row.user_id|string %} {% set is_cutoff = loop.index == season_info.playoff_teams %} {% endfor %}
Team Wins (W) Losses (L) Runs For (RF) Runs Against (RA) Games Back (GB)
{% if row.team_icon %} {{ row.team_name }} {% else %}
{% endif %} {{ row.team_name }} {% if row.clinch %}{{ row.clinch }}{% endif %}
{{ row.wins }} {{ row.losses }} {{ row.runs_for }} {{ row.runs_against }} {{ row.games_back }}
{% else %}

No standings available for the selected season.

{% endif %}
{% elif active_tab == 'schedule' %}

{{ season_info.name }} - Schedule

{% for month in months %}

{{ month.name }}

{% for day in ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] %}
{{ day }}
{% endfor %} {% for week in month.weeks %} {% for day in week %} {% set date_str = "%04d-%02d-%02d" % (month.year, month.month, day) if day != 0 else "" %}
{% if day != 0 %} {{ day }} {% if date_str in games_by_date %} {% for game in games_by_date[date_str] %} {% set is_away_mine = current_user.is_authenticated and current_user.id|string == game.away_team_id|string %} {% set is_home_mine = current_user.is_authenticated and current_user.id|string == game.home_team_id|string %}
{% if game.away_icon %} {% else %}
{% endif %} {{ game.away_score if game.status == 'Final' else '' }} @ {{ game.home_score if game.status == 'Final' else '' }} {% if game.home_icon %} {% else %}
{% endif %} {% if game.is_conditional %}*{% endif %} {% if game.pending_proposals > 0 %} {% endif %}
{% endfor %} {% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endfor %} {% if games_by_date['TBD'] %}

TBD Games

{% for game in games_by_date['TBD'] %}
TBD @ TBD (Playoff)
{% endfor %}
{% endif %}
{% elif active_tab == 'playoffs' %}

{{ season_info.name }} - Playoffs

{% if bracket %}
{% for round_games in bracket %}

Round {{ loop.index }}

{% for g in round_games %}
{{ g.away_team if g.away_team else 'TBD' }} {{ g.away_record if g.away_team else '' }} {{ g.away_series_wins }}
{{ g.home_team if g.home_team else 'TBD' }} {{ g.home_record if g.home_team else '' }} {{ g.home_series_wins }}
Best of {{ season_info.playoff_series_length }}
{% endfor %}
{% endfor %}
{% else %}

Playoff bracket not yet generated.

{% endif %}

Playoff Schedule

{% if playoff_games %}
{% for game in playoff_games %} {% set is_away_mine = current_user.is_authenticated and current_user.id|string == game.away_team_id|string %} {% set is_home_mine = current_user.is_authenticated and current_user.id|string == game.home_team_id|string %}
{{ game.scheduled_date }} - {{ game.status }} {% if game.is_conditional %}*{% endif %} {% if game.pending_proposals > 0 %}{% endif %}
{% if game.away_icon %} {% else %}
{% endif %}
{{ game.away_team if game.away_team else 'TBD' }}
{{ game.away_score if game.status == 'Final' else '-' }}
@
{% if game.home_icon %} {% else %}
{% endif %}
{{ game.home_team if game.home_team else 'TBD' }}
{{ game.home_score if game.status == 'Final' else '-' }}
{% endfor %}
{% else %}

No playoff games scheduled.

{% endif %}
{% endif %} {% endblock %}