Self hosted FLOSS fitness/workout, nutrition and weight tracker
Show one decimal place for nutrtional values
Roland Geider6c77cb17fa7e
diff --git a/wger/nutrition/templates/ingredient/view.html b/wger/nutrition/templates/ingredient/view.htmlindex eca06f168..0538d6bb9 100644--- a/wger/nutrition/templates/ingredient/view.html+++ b/wger/nutrition/templates/ingredient/view.html@@ -76,26 +76,26 @@ the search.{% endblocktrans %}<tr><td>{% trans "Energy" %}</td><td itemprop="calories" class="text-right">- <span id="value-energy">{{ingredient.energy}}</span> {% trans "kcal" %}+ <span id="value-energy">{{ingredient.energy|floatformat:1}}</span> {% trans "kcal" %}</td></tr><tr><td>{% trans "Protein" %}</td><td itemprop="proteinContent" class="text-right">- <span id="value-protein">{{ingredient.protein}}</span> {% trans "g" context "weight unit, i.e. grams" %}+ <span id="value-protein">{{ingredient.protein|floatformat:1}}</span> {% trans "g" context "weight unit, i.e. grams" %}</td></tr><tr><td>{% trans "Carbohydrates" %}</td><td itemprop="carbohydrateContent" class="text-right">- <span id="value-carbohydrates">{{ingredient.carbohydrates}}</span> {% trans "g" context "weight unit, i.e. grams" %}+ <span id="value-carbohydrates">{{ingredient.carbohydrates|floatformat}}</span> {% trans "g" context "weight unit, i.e. grams" %}</td></tr><tr><td class="pl-5">{% trans "Sugar content in carbohydrates" %}</td><td itemprop="sugarContent" class="text-right">{% if ingredient.carbohydrates_sugar %}- <span id="value-carbohydrates-sugar">{{ingredient.carbohydrates_sugar}}</span> {% trans "g" context "weight unit, i.e. grams" %}+ <span id="value-carbohydrates-sugar">{{ingredient.carbohydrates_sugar|floatformat:1}}</span> {% trans "g" context "weight unit, i.e. grams" %}{% else %}{% trans "n.A." %}{% endif %}@@ -104,14 +104,14 @@ the search.{% endblocktrans %}<tr><td>{% trans "Fat" %}</td><td itemprop="fatContent" class="text-right">- <span id="value-fat">{{ingredient.fat}}</span> {% trans "g" context "weight unit, i.e. grams" %}+ <span id="value-fat">{{ingredient.fat|floatformat:1}}</span> {% trans "g" context "weight unit, i.e. grams" %}</td></tr><tr><td class="pl-5">{% trans "Saturated fat content in fats" %}</td><td itemprop="saturatedFatContent" class="text-right">{% if ingredient.fat_saturated %}- <span id="value-fat-saturated">{{ingredient.fat_saturated}}</span> {% trans "g" context "weight unit, i.e. grams" %}+ <span id="value-fat-saturated">{{ingredient.fat_saturated|floatformat:1}}</span> {% trans "g" context "weight unit, i.e. grams" %}{% else %}{% trans "n.A." %}{% endif %}@@ -133,7 +133,7 @@ the search.{% endblocktrans %}<td>{% trans "Fibres" %}</td><td itemprop="fiberContent" class="text-right">{% if ingredient.fibres %}- <span id="value-fibres">{{ingredient.fibres}}</span> {% trans "g" context "weight unit, i.e. grams" %}+ <span id="value-fibres">{{ingredient.fibres|floatformat:1}}</span> {% trans "g" context "weight unit, i.e. grams" %}{% else %}{% trans "n.A." %}{% endif %}@@ -143,7 +143,7 @@ the search.{% endblocktrans %}<td>{% trans "Sodium" %}</td><td itemprop="sodiumContent" class="text-right">{% if ingredient.sodium %}- <span id="value-sodium">{{ingredient.sodium}}</span> {% trans "g" context "weight unit, i.e. grams" %}+ <span id="value-sodium">{{ingredient.sodium|floatformat:1}}</span> {% trans "g" context "weight unit, i.e. grams" %}{% else %}{% trans "n.A." %}{% endif %}diff --git a/wger/nutrition/templates/plan/view.html b/wger/nutrition/templates/plan/view.htmlindex bab577807..9b4d6fb80 100644--- a/wger/nutrition/templates/plan/view.html+++ b/wger/nutrition/templates/plan/view.html@@ -107,10 +107,10 @@ function wgerCustomModalInit()</span>{% endif %}</td>- <td class="align-right">{{item.get_nutritional_values.energy|floatformat}}</td>- <td class="align-right">{{item.get_nutritional_values.protein|floatformat}}</td>- <td class="align-right">{{item.get_nutritional_values.carbohydrates|floatformat}}</td>- <td class="align-right">{{item.get_nutritional_values.fat|floatformat}}</td>+ <td class="align-right">{{item.get_nutritional_values.energy|floatformat:1}}</td>+ <td class="align-right">{{item.get_nutritional_values.protein|floatformat:1}}</td>+ <td class="align-right">{{item.get_nutritional_values.carbohydrates|floatformat:1}}</td>+ <td class="align-right">{{item.get_nutritional_values.fat|floatformat:1}}</td></tr>{% empty %}{% if is_owner %}@@ -179,37 +179,37 @@ function wgerCustomModalInit()<tbody><tr><td>{% trans "Energy" %}</td>- <td class="align-right">{{nutritional_data.total.energy|floatformat}} {% trans "kcal" %}</td>+ <td class="align-right">{{nutritional_data.total.energy|floatformat:1}} {% trans "kcal" %}</td><td></td><td></td></tr><tr><td>{% trans "Protein" %}</td>- <td class="align-right">{{nutritional_data.total.protein|floatformat}} {% trans_weight_unit 'g' owner_user %}</td>- <td class="align-right">{{nutritional_data.percent.protein|floatformat}} %</td>+ <td class="align-right">{{nutritional_data.total.protein|floatformat:1}} {% trans_weight_unit 'g' owner_user %}</td>+ <td class="align-right">{{nutritional_data.percent.protein|floatformat:1}} %</td><td class="align-right">{{nutritional_data.per_kg.protein|floatformat:2}}</td></tr><tr><td>{% trans "Carbohydrates" %}</td>- <td class="align-right">{{nutritional_data.total.carbohydrates|floatformat}} {% trans_weight_unit 'g' owner_user %}</td>- <td class="align-right">{{nutritional_data.percent.carbohydrates|floatformat}} %</td>+ <td class="align-right">{{nutritional_data.total.carbohydrates|floatformat:1}} {% trans_weight_unit 'g' owner_user %}</td>+ <td class="align-right">{{nutritional_data.percent.carbohydrates|floatformat:1}} %</td><td class="align-right">{{nutritional_data.per_kg.carbohydrates|floatformat:2}}</td></tr><tr><td style="padding-left: 2em;">{% trans "Sugar content in carbohydrates" %}</td>- <td class="align-right">{{nutritional_data.total.carbohydrates_sugar|floatformat}} {% trans_weight_unit 'g' owner_user %}</td>+ <td class="align-right">{{nutritional_data.total.carbohydrates_sugar|floatformat:1}} {% trans_weight_unit 'g' owner_user %}</td><td></td><td></td></tr><tr><td>{% trans "Fat" %}</td>- <td class="align-right">{{nutritional_data.total.fat|floatformat}} {% trans_weight_unit 'g' owner_user %}</td>- <td class="align-right">{{nutritional_data.percent.fat|floatformat}} %</td>+ <td class="align-right">{{nutritional_data.total.fat|floatformat:1}} {% trans_weight_unit 'g' owner_user %}</td>+ <td class="align-right">{{nutritional_data.percent.fat|floatformat:1}} %</td><td class="align-right">{{nutritional_data.per_kg.fat|floatformat:2}}</td></tr><tr><td style="padding-left: 2em;">{% trans "Saturated fat content in fats" %}</td>- <td class="align-right">{{nutritional_data.total.fat_saturated|floatformat}} {% trans_weight_unit 'g' owner_user %}</td>+ <td class="align-right">{{nutritional_data.total.fat_saturated|floatformat:1}} {% trans_weight_unit 'g' owner_user %}</td><td></td><td></td></tr>