**STATUS_2026-03-27.md (NEW):** - Complete current state documentation - Testing checklist for v0.9h - Code splitting plan - Phase 0b roadmap (120+ placeholders) - Resumption guide for future sessions **Issue #52 (NEW):** - Blood pressure goals need dual targets (systolic/diastolic) - Migration 033 planned - 2-3h estimated effort **CLAUDE.md Updated:** - Version: v0.9g+ → v0.9h - Dynamic Focus Areas v2.0 section added - Bug fixes documented - Current status: READY FOR RELEASE **Updates:** - Phase 0a: COMPLETE ✅ - Phase 0b: NEXT (after code splitting) - All Gitea issues reviewed - Comprehensive resumption documentation **Action Items for User:** - [ ] Manually close Gitea Issue #25 (Goals System - complete) - [ ] Create Gitea Issue #52 from docs/issues/issue-52-*.md - [ ] Review STATUS document before next session
158 lines
3.8 KiB
Markdown
158 lines
3.8 KiB
Markdown
# Issue #52: Blutdruck-Ziele benötigen zwei Zielfelder
|
|
|
|
**Status:** 🔲 OFFEN
|
|
**Erstellt:** 27.03.2026
|
|
**Priorität:** Medium
|
|
**Typ:** Enhancement
|
|
**Labels:** goals, blood-pressure, enhancement
|
|
**Aufwand:** 2-3h
|
|
|
|
---
|
|
|
|
## Problem
|
|
|
|
**Aktuell:**
|
|
- Blutdruck-Ziele (goal_type = 'bp') haben nur EIN Zielfeld (`target_value`)
|
|
- Blutdruck besteht aber aus ZWEI Werten: Systolisch + Diastolisch
|
|
- Beispiel-Ziel: "Blutdruck senken auf 120/80 mmHg"
|
|
- Systolisch (oberer Wert): 120
|
|
- Diastolisch (unterer Wert): 80
|
|
|
|
**Konsequenz:**
|
|
- User kann nur einen Wert als Ziel eingeben
|
|
- Unvollständige Zieldefinition
|
|
- Progress-Tracking ungenau
|
|
|
|
---
|
|
|
|
## Lösung
|
|
|
|
### Option A: Dual Target Fields (empfohlen)
|
|
|
|
**Schema-Änderung:**
|
|
```sql
|
|
-- Migration 033
|
|
ALTER TABLE goals ADD COLUMN target_value_secondary DECIMAL(10,2);
|
|
ALTER TABLE goals ADD COLUMN current_value_secondary DECIMAL(10,2);
|
|
ALTER TABLE goals ADD COLUMN start_value_secondary DECIMAL(10,2);
|
|
|
|
COMMENT ON COLUMN goals.target_value_secondary IS 'Secondary target (e.g., diastolic BP for bp goal type)';
|
|
```
|
|
|
|
**Anwendung:**
|
|
- `bp` goal type:
|
|
- `target_value` = Systolisch (120)
|
|
- `target_value_secondary` = Diastolisch (80)
|
|
- Andere goal types: `target_value_secondary` = NULL
|
|
|
|
**UI-Anpassung:**
|
|
```jsx
|
|
// GoalForm - conditional rendering
|
|
{formData.goal_type === 'bp' && (
|
|
<div style={{display:'grid', gridTemplateColumns:'1fr 1fr', gap:12}}>
|
|
<div>
|
|
<label>Systolisch (oben)</label>
|
|
<input type="number" value={formData.target_value} />
|
|
</div>
|
|
<div>
|
|
<label>Diastolisch (unten)</label>
|
|
<input type="number" value={formData.target_value_secondary} />
|
|
</div>
|
|
</div>
|
|
)}
|
|
```
|
|
|
|
**Progress-Berechnung:**
|
|
```python
|
|
def calculate_bp_progress(goal):
|
|
"""
|
|
Berechnet Progress für Blutdruck-Ziele.
|
|
Nimmt Durchschnitt von systolischem und diastolischem Progress.
|
|
"""
|
|
systolic_progress = calculate_single_progress(
|
|
goal.current_value, goal.start_value, goal.target_value
|
|
)
|
|
diastolic_progress = calculate_single_progress(
|
|
goal.current_value_secondary,
|
|
goal.start_value_secondary,
|
|
goal.target_value_secondary
|
|
)
|
|
|
|
return (systolic_progress + diastolic_progress) / 2
|
|
```
|
|
|
|
**Display:**
|
|
```
|
|
🎯 Blutdruck
|
|
━━━━━━━━━━━━━━━━━━━━
|
|
Ziel: 120/80 mmHg
|
|
Aktuell: 135/88 mmHg
|
|
Fortschritt: 68% (sys: 60%, dia: 75%)
|
|
━━━━━━━━━━━━━━━━━━━━
|
|
```
|
|
|
|
---
|
|
|
|
### Option B: JSON Target (flexibler, komplexer)
|
|
|
|
```sql
|
|
ALTER TABLE goals ADD COLUMN target_json JSONB;
|
|
|
|
-- Beispiel:
|
|
{
|
|
"systolic": 120,
|
|
"diastolic": 80,
|
|
"unit": "mmHg"
|
|
}
|
|
```
|
|
|
|
**Nachteil:** Komplexer zu abfragen, weniger SQL-freundlich.
|
|
|
|
---
|
|
|
|
## Betroffene Dateien
|
|
|
|
**Backend:**
|
|
- `backend/migrations/033_dual_target_fields.sql` (NEU)
|
|
- `backend/routers/goals.py` - Progress-Berechnung erweitern
|
|
- `backend/routers/goal_utils.py` - `_get_current_value_for_goal_type()` für BP
|
|
|
|
**Frontend:**
|
|
- `frontend/src/pages/GoalsPage.jsx` - Form conditional rendering
|
|
- `frontend/src/pages/GoalsPage.jsx` - Display conditional rendering
|
|
- `frontend/src/pages/CustomGoalsPage.jsx` - Dual input für BP
|
|
|
|
---
|
|
|
|
## Acceptance Criteria
|
|
|
|
- [ ] Migration 033 erstellt und angewandt
|
|
- [ ] GoalForm zeigt zwei Felder für BP-Ziele (Systolisch/Diastolisch)
|
|
- [ ] Progress-Berechnung berücksichtigt beide Werte
|
|
- [ ] Display zeigt "120/80 mmHg" Format
|
|
- [ ] CustomGoalsPage erlaubt Eingabe beider Werte
|
|
- [ ] Backward compatible (alte BP-Ziele mit nur target_value funktionieren noch)
|
|
|
|
---
|
|
|
|
## Verwandte Issues
|
|
|
|
- Issue #50: Goals System v1 ✅
|
|
- Issue #51: Dynamic Focus Areas v2.0 ✅
|
|
- Migration 022: goals table (Basis)
|
|
|
|
---
|
|
|
|
## Timeline
|
|
|
|
**Geschätzt:** 2-3 Stunden
|
|
- Migration: 30 min
|
|
- Backend Logic: 1h
|
|
- Frontend UI: 1-1.5h
|
|
- Testing: 30 min
|
|
|
|
---
|
|
|
|
**Erstellt von:** Claude Code
|
|
**Review benötigt:** Vor Implementierung mit User abstimmen (Option A vs. B)
|