{% extends "base.html" %} {% block content %}

{{ current_date.strftime('%A, %B %d, %Y') }}

{% if is_modified %} Custom {% else %} As Planned {% endif %}
{% if is_modified %} {% endif %}
{% set meal_times = ["Breakfast", "Lunch", "Dinner", "Snack 1", "Snack 2", "Beverage 1", "Beverage 2"] %} {% for meal_time in meal_times %}
{{ meal_time }}
{% set meals_for_time = [] %} {% for tracked_meal in tracked_meals %} {% if tracked_meal.meal_time == meal_time %} {% set _ = meals_for_time.append(tracked_meal) %} {% endif %} {% endfor %} {% if meals_for_time %} {% for tracked_meal in meals_for_time %}
{{ tracked_meal.meal.name }}
{% set overrides = {} %} {% set all_override_ids = [] %} {% set deleted_food_ids = [] %} {% for tmf in tracked_meal.tracked_foods %} {% if not tmf.is_deleted %} {% set _ = overrides.update({tmf.food_id: tmf}) %} {% else %} {% set _ = deleted_food_ids.append(tmf.food_id) %} {% endif %} {% set _ = all_override_ids.append(tmf.food_id) %} {% endfor %} {% set displayed_food_ids = [] %} {# Display base meal foods, applying overrides #} {% for meal_food in tracked_meal.meal.meal_foods %} {# Only show base meal food if it's not deleted and there's no active override for it #} {% if meal_food.food_id not in deleted_food_ids and meal_food.food_id not in overrides.keys() %}
• {{ meal_food.food.name }} {{ meal_food.quantity }} {{ meal_food.food.serving_unit }}
{% else %} {% endif %} {% set _ = displayed_food_ids.append(meal_food.food_id) %} {% endfor %} {# Display overridden and new foods #} {% for food_id, tmf in overrides.items() %}
• {{ tmf.food.name }} {{ tmf.quantity }} g
{% endfor %}
{% if not tracked_meal.meal.meal_foods %}
No foods in this meal
{% endif %}
{% endfor %} {% else %}

No meals tracked

{% endif %}
{% endfor %}
Daily Totals
{{ "%.0f"|format(day_totals.calories) }}
Calories
{{ "%.1f"|format(day_totals.protein) }}g
Protein ({{ day_totals.protein_pct }}%)
{{ "%.1f"|format(day_totals.carbs) }}g
Carbs ({{ day_totals.carbs_pct }}%)
{{ "%.1f"|format(day_totals.fat) }}g
Fat ({{ day_totals.fat_pct }}%)
{{ "%.1f"|format(day_totals.fiber) }}g
Fiber
{{ "%.1f"|format(day_totals.net_carbs) }}g
Net Carbs
{{ "%.0f"|format(day_totals.sugar) }}g
Sugar
{{ "%.0f"|format(day_totals.sodium) }}mg
Sodium
{% include 'modals/add_meal.html' %} {% include 'modals/save_template.html' %} {% include 'modals/apply_template.html' %} {% include 'modals/edit_tracked_meal.html' %} {% include 'modals/add_single_food.html' %} {% endblock %}