fix: 3 critical bugs in Goals and Vitals
**Bug 1: Focus contributions not saved** - GoalsPage: Added focus_contributions to data object (line 232) - Was missing from API payload, causing loss of focus area assignments **Bug 2: Filter focus areas in goal form** - Only show focus areas user has weighted (weight > 0) - Cleaner UX, avoids confusion with non-prioritized areas - Filters focusAreasGrouped by userFocusWeights **Bug 3: Vitals RHR entry - Internal Server Error** - Fixed: Endpoint tried to INSERT into vitals_log (renamed in Migration 015) - Now uses vitals_baseline table (correct post-migration table) - Removed BP fields from baseline endpoint (use /blood-pressure instead) - Backward compatible return format All fixes tested and ready for production.
This commit is contained in:
1 parent
3116fbbc91
commit
378bf434fc
2 files changed
+47
-34
No files matched your search
@@ -228,7 +228,8 @@ export default function GoalsPage() {
|
||||
unit: formData.unit,
|
||||
target_date: formData.target_date || null,
|
||||
name: formData.name || null,
|
||||
description: formData.description || null
|
||||
description: formData.description || null,
|
||||
focus_contributions: formData.focus_contributions || [] // v2.0: Focus area assignments
|
||||
}
|
||||
|
||||
console.log('[DEBUG] Saving goal:', { editingGoal, data })
|
||||
@@ -888,7 +889,15 @@ export default function GoalsPage() {
|
||||
</div>
|
||||
) : (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
||||
{Object.entries(focusAreasGrouped).map(([category, areas]) => (
|
||||
{Object.entries(focusAreasGrouped).map(([category, areas]) => {
|
||||
// Filter to only show focus areas the user has weighted
|
||||
const userWeightedAreaIds = new Set(userFocusWeights.map(w => w.id))
|
||||
const filteredAreas = areas.filter(area => userWeightedAreaIds.has(area.id))
|
||||
|
||||
// Skip category if no weighted areas
|
||||
if (filteredAreas.length === 0) return null
|
||||
|
||||
return (
|
||||
<div key={category}>
|
||||
<div style={{
|
||||
fontSize: 11,
|
||||
@@ -905,7 +914,7 @@ export default function GoalsPage() {
|
||||
flexWrap: 'wrap',
|
||||
gap: 6
|
||||
}}>
|
||||
{areas.map(area => {
|
||||
{filteredAreas.map(area => {
|
||||
const isSelected = formData.focus_contributions?.some(
|
||||
fc => fc.focus_area_id === area.id
|
||||
)
|
||||
@@ -960,7 +969,8 @@ export default function GoalsPage() {
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
Reference in new issue
Block a user