Sports macros now use new state attribute from team tracker integration

This commit is contained in:
2023-06-04 18:19:22 -04:00
parent 37273017bb
commit 71c1f5756b

View File

@ -15,22 +15,24 @@
{% if date == now().strftime('%m-%d') %} {% if date == now().strftime('%m-%d') %}
{% if state_attr(team,'clock') in ['postponed','Postponed'] %} {% if state_attr(team,'clock') in ['postponed','Postponed'] %}
"The {{ state_attr(team,'friendly_name') }} had their game postponed today, and it will be played at a later date. " "The {{ state_attr(team,'friendly_name') }} had their game postponed today, and it will be played at a later date. "
{% elif (state_attr(team,'team_score') | int) > (state_attr(team,'opponent_score') | int) %}
"The {{ state_attr(team,'friendly_name') }} won their game today against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. "
{% elif (state_attr(team,'team_score') | int) == state_attr(team,'opponent_score') | int %} {% elif (state_attr(team,'team_score') | int) == state_attr(team,'opponent_score') | int %}
"The {{ state_attr(team,'friendly_name') }} tied in their game today against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. " "The {{ state_attr(team,'friendly_name') }} tied in their game today against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. "
{% else %} {% elif state_attr(team,'team_winner') == 'true' %}
"The {{ state_attr(team,'friendly_name') }} won their game today against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. "
{% elif state_attr(team,'opponent_winner') == 'true' %}
"The {{ state_attr(team,'friendly_name') }} lost their game today against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }}. " "The {{ state_attr(team,'friendly_name') }} lost their game today against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }}. "
{% endif %} {% endif %}
{% if state_attr(team,'clock') not in ['postponed','Postponed'] %} {% if state_attr(team,'clock') not in ['postponed','Postponed'] %}
"This brings their record to {{ state_attr(team,'team_record') | replace("-"," and ") }} on the season. " "This brings their record to {{ state_attr(team,'team_record') | replace("-"," and ") }} on the season. "
{% endif %} {% endif %}
{% elif yday == date %} {% elif yday == date %}
{% if (state_attr(team,'team_score') | int) > (state_attr(team,'opponent_score') | int) %} {% if state_attr(team,'clock') in ['postponed','Postponed'] %}
"The {{ state_attr(team,'friendly_name') }} won their game yesterday against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. " "The {{ state_attr(team,'friendly_name') }} had their game postponed yesterday, and it will be played at a later date. "
{% elif (state_attr(team,'team_score') | int) == state_attr(team,'opponent_score') | int %} {% elif (state_attr(team,'team_score') | int) == state_attr(team,'opponent_score') | int %}
"The {{ state_attr(team,'friendly_name') }} tied in their game yesterday against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. " "The {{ state_attr(team,'friendly_name') }} tied in their game yesterday against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. "
{% else %} {% elif state_attr(team,'team_winner') == 'true' %}
"The {{ state_attr(team,'friendly_name') }} won their game yesterday against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. "
{% elif state_attr(team,'opponent_winner') == 'true' %}
"The {{ state_attr(team,'friendly_name') }} lost their game yesterday against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }}. " "The {{ state_attr(team,'friendly_name') }} lost their game yesterday against the {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }}. "
{% endif %} {% endif %}
{% if state_attr(team,'clock') not in ['postponed','Postponed'] %} {% if state_attr(team,'clock') not in ['postponed','Postponed'] %}
@ -38,10 +40,10 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
{% elif is_state(team,'IN') %} {% elif is_state(team,'IN') %}
{% if (state_attr(team,'team_score') | int) > (state_attr(team,'opponent_score') | int) %} {% if (state_attr(team,'team_score') | int) == (state_attr(team,'opponent_score') | int) %}
"The {{ state_attr(team,'friendly_name') }} are currently winning their game against the {{ state_attr(team,'opponent_name') }} with a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. "
{% elif (state_attr(team,'team_score') | int) == (state_attr(team,'opponent_score') | int) %}
"The {{ state_attr(team,'friendly_name') }} are currently tied in their game against the {{ state_attr(team,'opponent_name') }} with a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. " "The {{ state_attr(team,'friendly_name') }} are currently tied in their game against the {{ state_attr(team,'opponent_name') }} with a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. "
{% elif (state_attr(team,'team_score') | int) > (state_attr(team,'opponent_score') | int) %}
"The {{ state_attr(team,'friendly_name') }} are currently winning their game against the {{ state_attr(team,'opponent_name') }} with a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}. "
{% else %} {% else %}
"The {{ state_attr(team,'friendly_name') }} are currently losing their game against the {{ state_attr(team,'opponent_name') }} with a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }}. " "The {{ state_attr(team,'friendly_name') }} are currently losing their game against the {{ state_attr(team,'opponent_name') }} with a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }}. "
{% endif %} {% endif %}