{% for i in range((end_date-start_date).days + 1) %}
{% set date = start_date + timedelta(days=i) %}
{% set workout = person['Workouts'] |
get_first_element_from_list_with_matching_attribute(
'StartDate',
date) %}
{{ date.day }}
{% if workout['TopSets']|length > 0 %}
{% for topset in workout['TopSets'] %}
{% endfor %}
{% endif %}
{% endfor %}
{% elif selected_view == 'year'%}
{% for i in range(12) %}
{% set date = start_date + relativedelta(months=i) %}
{% set first_day_of_month = date.replace(day=1) %}
{% set last_day_of_month = date + relativedelta(day=31) %}
{% set (first_day, last_day) = first_and_last_visible_days_in_month(first_day_of_month, last_day_of_month)
%}
{{
first_day_of_month | strftime('%B %Y') }}
S
M
T
W
T
F
S
{% for i in range((last_day-first_day).days + 1) %}
{% set day_date = first_day + timedelta(days=i) %}
{% set workout = person['Workouts'] | get_first_element_from_list_with_matching_attribute(
'StartDate',
day_date) %}
{% set is_in_month = day_date.month == first_day_of_month.month%}
{% if is_in_month %}
{{ day_date.day }} {% endif %}