Goalsystem V1 #50

Merged
Lars merged 51 commits from develop into main 2026-03-27 17:40:51 +01:00
2 changed files with 31 additions and 4 deletions
Showing only changes of commit 27a8af7008 - Show all commits

View File

@ -444,10 +444,17 @@ def _get_current_value_for_goal_type(conn, profile_id: str, goal_type: str) -> O
bf_row = cur.fetchone() bf_row = cur.fetchone()
if weight_row and bf_row: if weight_row and bf_row:
try:
weight = float(weight_row['weight']) weight = float(weight_row['weight'])
bf_pct = float(bf_row['body_fat_pct']) bf_pct = float(bf_row['body_fat_pct'])
lean_mass = weight - (weight * bf_pct / 100.0) lean_mass = weight - (weight * bf_pct / 100.0)
return round(lean_mass, 2) return round(lean_mass, 2)
except (ValueError, TypeError) as e:
print(f"[DEBUG] lean_mass calculation error: {e}, weight={weight_row}, bf={bf_row}")
return None
# Debug: Log why calculation failed
print(f"[DEBUG] lean_mass calc failed - weight_row: {weight_row is not None}, bf_row: {bf_row is not None}")
return None return None
elif goal_type == 'vo2max': elif goal_type == 'vo2max':

View File

@ -167,6 +167,8 @@ export default function GoalsPage() {
description: formData.description || null description: formData.description || null
} }
console.log('[DEBUG] Saving goal:', { editingGoal, data })
if (editingGoal) { if (editingGoal) {
await api.updateGoal(editingGoal, data) await api.updateGoal(editingGoal, data)
showToast('✓ Ziel aktualisiert') showToast('✓ Ziel aktualisiert')
@ -493,6 +495,24 @@ export default function GoalsPage() {
</option> </option>
))} ))}
</select> </select>
{/* Warning for incomplete goal types */}
{['bp', 'strength', 'flexibility'].includes(formData.goal_type) && (
<div style={{
marginTop: 8,
padding: 8,
background: '#FEF3C7',
border: '1px solid #F59E0B',
borderRadius: 6,
fontSize: 12,
color: '#92400E'
}}>
Dieser Zieltyp ist aktuell eingeschränkt:
{formData.goal_type === 'bp' && ' Blutdruck benötigt 2 Werte (geplant für v2.0)'}
{formData.goal_type === 'strength' && ' Keine Datenquelle vorhanden (geplant für v2.0)'}
{formData.goal_type === 'flexibility' && ' Keine Datenquelle vorhanden (geplant für v2.0)'}
</div>
)}
</div> </div>
{/* Name */} {/* Name */}