feat: update app version to 0.9t and enhance nutrition visualization
Deploy Development / deploy (push) Successful in 55s
Build Test / pytest-backend (push) Successful in 4s
Build Test / lint-backend (push) Successful in 1s
Build Test / build-frontend (push) Successful in 16s

- Bumped application version to 0.9t and updated changelog with new features.
- Integrated new chart payloads for energy balance, protein adequacy, and nutrition adherence to optimize data retrieval and reduce HTTP requests.
- Updated NutritionCharts component to utilize prefetched chart payloads, improving loading efficiency and user experience.
- Refactored History page to pass chart payloads, enhancing the visualization of nutrition trends without additional requests.
This commit is contained in:
Lars committed 2026-04-20 14:51:27 +02:00
1 parent da1e0410cc
commit 3f6673b636
6 files changed
+485 -405

No files matched your search

+35 -9
View File
@@ -205,12 +205,14 @@ export function WeeklyMacroDistributionPanel({ macroWeeklyData, loading, error }
/**
* Nutrition Charts (E1–E5). Verlauf: `showWeeklyMacroDistribution={false}` wenn E3 separat (z. B. neben Donut) gerendert wird.
* @param {object} [prefetchedChartPayloads] — aus GET /charts/nutrition-history-viz (`chart_payloads`): E1/E2/E4 ohne Extra-Requests (Phase C).
*/
export default function NutritionCharts({
days = 28,
showWeeklyMacroDistribution = true,
/** Verlauf: E5-Kachel liegt in nutrition-history-viz KPIs — doppelte Karte ausblenden */
hideEnergyAvailabilityCard = false,
prefetchedChartPayloads = null,
}) {
const [energyData, setEnergyData] = useState(null)
const [proteinData, setProteinData] = useState(null)
@@ -226,20 +228,44 @@ export default function NutritionCharts({
useEffect(() => {
loadCharts()
}, [days, showWeeklyMacroDistribution, hideEnergyAvailabilityCard])
}, [days, showWeeklyMacroDistribution, hideEnergyAvailabilityCard, prefetchedChartPayloads])
const loadCharts = async () => {
const tasks = [
loadEnergyBalance(),
loadProteinAdequacy(),
loadAdherence(),
]
const p = prefetchedChartPayloads
const tasks = []
if (p?.energy_balance) {
setEnergyData(p.energy_balance)
setLoading((l) => ({ ...l, energy: false }))
setErrors((e) => ({ ...e, energy: null }))
} else {
tasks.push(loadEnergyBalance())
}
if (p?.protein_adequacy) {
setProteinData(p.protein_adequacy)
setLoading((l) => ({ ...l, protein: false }))
setErrors((e) => ({ ...e, protein: null }))
} else {
tasks.push(loadProteinAdequacy())
}
if (showWeeklyMacroDistribution) {
tasks.push(loadMacroWeekly())
}
if (p?.nutrition_adherence) {
setAdherenceData(p.nutrition_adherence)
setLoading((l) => ({ ...l, adherence: false }))
setErrors((e) => ({ ...e, adherence: null }))
} else {
tasks.push(loadAdherence())
}
if (!hideEnergyAvailabilityCard) {
tasks.push(loadWarning())
}
if (showWeeklyMacroDistribution) {
tasks.splice(2, 0, loadMacroWeekly())
}
await Promise.all(tasks)
}