display weight
This commit is contained in:
parent
5bfcb3ea9a
commit
b02a0ac6ad
5 changed files with 8 additions and 8 deletions
|
|
@ -5,7 +5,8 @@ SELECT
|
||||||
kc_per_serving,
|
kc_per_serving,
|
||||||
target_servings,
|
target_servings,
|
||||||
coalesce(day_serving.servings_eaten, 0),
|
coalesce(day_serving.servings_eaten, 0),
|
||||||
color
|
color,
|
||||||
|
portion_weight
|
||||||
FROM
|
FROM
|
||||||
food
|
food
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ SELECT
|
||||||
food.kc_per_serving,
|
food.kc_per_serving,
|
||||||
food.target_servings,
|
food.target_servings,
|
||||||
coalesce(day_serving.servings_eaten, 0) as servings_eaten,
|
coalesce(day_serving.servings_eaten, 0) as servings_eaten,
|
||||||
food.color
|
food.color,
|
||||||
|
food.portion_weight
|
||||||
FROM
|
FROM
|
||||||
food
|
food
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ struct Food {
|
||||||
target_servings: i32,
|
target_servings: i32,
|
||||||
servings_eaten: i32,
|
servings_eaten: i32,
|
||||||
color: String,
|
color: String,
|
||||||
|
portion_weight: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Food {
|
impl Food {
|
||||||
|
|
@ -71,6 +72,7 @@ impl Food {
|
||||||
target_servings: row.get(4)?,
|
target_servings: row.get(4)?,
|
||||||
servings_eaten: row.get(5)?,
|
servings_eaten: row.get(5)?,
|
||||||
color: row.get(6)?,
|
color: row.get(6)?,
|
||||||
|
portion_weight: row.get(7)?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,12 @@
|
||||||
<div class="amounts">
|
<div class="amounts">
|
||||||
<p class="unit">
|
<p class="unit">
|
||||||
<!-- <sup>1</sup>⁄<sub>4</sub> Cup -->
|
<!-- <sup>1</sup>⁄<sub>4</sub> Cup -->
|
||||||
{{ food.portion }}
|
{{ food.portion }} ({{ food.portion_weight }} g)
|
||||||
</p>
|
</p>
|
||||||
<p class="kc">
|
<p class="kc">
|
||||||
{{ food.kc_per_serving }} kc
|
{{ food.kc_per_serving }} kc
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="buttons">
|
|
||||||
<button class="increase" hx-post="/increase/{{ food.id }}" hx-target="#card-{{ food.id }}">+</button>
|
|
||||||
<button class="decrease" hx-post="/decrease/{{ food.id }}" hx-target="#card-{{ food.id }}">-</button>
|
|
||||||
</div>
|
|
||||||
<div class="checkboxes">
|
<div class="checkboxes">
|
||||||
{% for counter in self::range(10) %}
|
{% for counter in self::range(10) %}
|
||||||
{% if loop.index as i32 <= food.target_servings %}
|
{% if loop.index as i32 <= food.target_servings %}
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.amounts {
|
.amounts {
|
||||||
width: 4em;
|
width: 8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.increase {
|
.increase {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue