unit consistency changes

This commit is contained in:
2025-10-01 14:36:42 -07:00
parent 7ffc57a7a8
commit bb30f9eb2b
18 changed files with 726 additions and 120 deletions

View File

@@ -166,7 +166,7 @@
</td>
<td>
<div class="serving-info">
{{ "%.1f"|format(meal_food.num_servings) }} × {{ meal_food.serving_size }}{{ meal_food.serving_unit }} ({{ "%.0f"|format(meal_food.total_grams) }}g)
{{ "%.0f"|format(meal_food.total_grams) }}g ({{ "%.2f"|format(meal_food.num_servings) }} servings of {{ meal_food.serving_size }}{{ meal_food.serving_unit }})
</div>
</td>
<td class="nutrient-value">{{ "%.0f"|format(meal_food.calories) }}</td>

View File

@@ -158,7 +158,7 @@
</td>
<td>
<div class="serving-info">
{{ "%.1f"|format(meal_food.num_servings) }} × {{ meal_food.serving_size }}{{ meal_food.serving_unit }} ({{ "%.0f"|format(meal_food.total_grams) }}g)
{{ "%.0f"|format(meal_food.total_grams) }}g ({{ "%.2f"|format(meal_food.num_servings) }} servings of {{ meal_food.serving_size }}{{ meal_food.serving_unit }})
</div>
</td>
<td class="nutrient-value">{{ "%.0f"|format(meal_food.calories) }}</td>

View File

@@ -26,7 +26,7 @@
{% if meal.meal_foods %}
<ul class="list-unstyled">
{% for meal_food in meal.meal_foods %}
<li>{{ "%.2f" | format(meal_food.quantity) }}g × {{ meal_food.food.name }}</li>
<li>{{ meal_food.quantity }}g of {{ meal_food.food.name }} ({{ (meal_food.quantity / meal_food.food.serving_size)|round(2) }} servings of {{ meal_food.food.serving_size }}{{ meal_food.food.serving_unit }})</li>
{% endfor %}
</ul>
{% else %}

View File

@@ -23,8 +23,8 @@
</select>
</div>
<div class="mb-3">
<label class="form-label">Quantity</label>
<input type="number" step="0.01" class="form-control" name="quantity" value="1" required>
<label class="form-label">Quantity (g)</label>
<input type="number" step="0.01" class="form-control" name="quantity" value="100" placeholder="Enter weight in grams" required>
</div>
<button type="button" class="btn btn-success" onclick="addFoodToTrackedMeal()">Add Food</button>
</form>

View File

@@ -0,0 +1,5 @@
{% extends "base.html" %}
{% block content %}
<h1>Test Template</h1>
<p>This is a test template to check if inheritance works.</p>
{% endblock %}